HELP Converting vbScript to Visual basic 2010

  • (2 Pages)
  • +
  • 1
  • 2

26 Replies - 2364 Views - Last Post: 13 February 2013 - 06:26 PM Rate Topic: -----

#16 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 08 February 2013 - 06:42 PM

View PostHeBTeMy, on 08 February 2013 - 06:20 PM, said:

Yeah, that was the error, didn't know that... thanks.

btw, that's why i turned off these "Option"'s , http://prntscr.com/s1rxs

Maybe some will give error when i get there... or run it, but right know it only has one...

Well, the thing is, those oprions will help you immensely in your coding. Many beginners don't turn them on because they end up with errors. They still have the errors, and some of them couuld be VERY dificult to find at run time.
If you take a look at the underlines, and drive your mouse pointer over them, they will tell you what the errors are, and if you drive the pointer over the little red thing at the end of the underline, and click on the little exclamation mark, it will often sugges a fix.

Being a naturally lazy programmer, I will often just type something like intValue = TextBox.Text *5, and then just use the editor to put in the Cint() for me. So as you can see, it can actually save time and keystrokes once you get on to it.

Quote

And since i didn't make this vbscript i'm not able to correct it, cause i don't know what it is...

"Operator 'Xor' is not defined for types 'Object' and 'System.Array'."

OK.. leave the Options on, and make some corrections. All those variables that start with str should be declared as strings. For example, instead of:

strKeyPath = "blah blah..."

it should be :
Dim strKeyPath As String = "blah blah..."

iValues sgould be an integer type, so:
Dim iValues() as Integer

I'm not sure what oReg should be, because I can't tell from this snippet.

The Xor thing.. yup, not an operator for Object or array. It might be for an element in an array, or for a property of an object. Basically, Xor will work on a boolean or on an integer.

Hang in there and apply some thought to it. Good Luck!
Was This Post Helpful? 0
  • +
  • -

#17 HeBTeMy  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 299
  • Joined: 05-October 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 09 February 2013 - 11:24 AM

I managed to correct some "errors", (yeah, i turned Option Strict Off, but explicit is still on...)

http://prntscr.com/s4pzr

What does "k" should be? I tried declare integer or string, but gives the same error...

Thanks.
Was This Post Helpful? 0
  • +
  • -

#18 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 09 February 2013 - 12:22 PM

View PostHeBTeMy, on 09 February 2013 - 12:24 PM, said:

I managed to correct some "errors", (yeah, i turned Option Strict Off, but explicit is still on...)

I am wondering why you say "errors", with the quotes. If they show up as errors with Option Strict On, they are definitely errors.

Quote

What does "k" should be? I tried declare integer or string, but gives the same error...

It looks like it should be a type of integer, since it is being Xor'd with a value from what looks to be an array. There are several integer types.. Int16, Int32, Integer, BYTE, etc. Two questions for you...

1. What is the error that is being reported?
2. What type is arrDPID() ?

I would assume it to be one of the Integer types, and the "* 256" tells me it's at least 16 bits.
Was This Post Helpful? 0
  • +
  • -

#19 HeBTeMy  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 299
  • Joined: 05-October 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 09 February 2013 - 02:48 PM

The error is in the print i posted, u'd have scrool down too see... but:

Value of type 'Double' cannot be converted to 'System.Array'.

About the type, it says 32-bit.
Was This Post Helpful? 0
  • +
  • -

#20 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 09 February 2013 - 08:13 PM

View PostHeBTeMy, on 09 February 2013 - 03:48 PM, said:

The error is in the print i posted, u'd have scrool down too see... but:

Value of type 'Double' cannot be converted to 'System.Array'.

About the type, it says 32-bit.

Try changing the declarations of k and arrDPID() to:

   Dim arrDPID() as Int32
   Dim k as Int32 = 0


Then get rid of the line (if you haven't already,
   arrDPID = Array()


Was This Post Helpful? 0
  • +
  • -

#21 HeBTeMy  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 299
  • Joined: 05-October 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 10 February 2013 - 01:36 PM

View Postlar3ry, on 09 February 2013 - 08:13 PM, said:

View PostHeBTeMy, on 09 February 2013 - 03:48 PM, said:

The error is in the print i posted, u'd have scrool down too see... but:

Value of type 'Double' cannot be converted to 'System.Array'.

About the type, it says 32-bit.

Try changing the declarations of k and arrDPID() to:

   Dim arrDPID() as Int32
   Dim k as Int32 = 0


Then get rid of the line (if you haven't already,
   arrDPID = Array()



Yeah, it worked, now i have "one" last error, wich i don't know which it specifies too, even with searching.
http://img687.images...6/thankyouo.png

Appreciate the help !
Was This Post Helpful? 0
  • +
  • -

#22 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3523
  • View blog
  • Posts: 12,031
  • Joined: 12-December 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 10 February 2013 - 01:51 PM

I don't believe you want that expression within SetAttr; it should be

Dim colOperatingSystems = something

Was This Post Helpful? 0
  • +
  • -

#23 HeBTeMy  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 299
  • Joined: 05-October 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 10 February 2013 - 01:55 PM

I know i have to do that, i just don't know what it his... will try to search more, just misses the "something" xD
Was This Post Helpful? 0
  • +
  • -

#24 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3523
  • View blog
  • Posts: 12,031
  • Joined: 12-December 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 10 February 2013 - 02:00 PM

Erm, don't you already have the "something"..?

Dim colOperatingSystems = objWMIService.ExecService("SELECT I can't be bothered typing the rest")

Was This Post Helpful? 0
  • +
  • -

#25 HeBTeMy  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 299
  • Joined: 05-October 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 10 February 2013 - 02:05 PM

View Postandrewsw, on 10 February 2013 - 02:00 PM, said:

Erm, don't you already have the "something"..?

Dim colOperatingSystems = objWMIService.ExecService("SELECT I can't be bothered typing the rest")


No, i don't... http://img687.images...6/thankyouo.png
Was This Post Helpful? 0
  • +
  • -

#26 HeBTeMy  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 299
  • Joined: 05-October 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 11 February 2013 - 12:16 PM

View Postandrewsw, on 10 February 2013 - 02:00 PM, said:

Erm, don't you already have the "something"..?

Dim colOperatingSystems = objWMIService.ExecService("SELECT I can't be bothered typing the rest")


You're right, i was confusing it with the other... my bad.

Now, i'm getting this warnings, and when i run it and click the button it shows http://img198.images...65/errorwep.png
Posted Image

Any help?

This post has been edited by modi123_1: 11 February 2013 - 12:19 PM
Reason for edit:: please use image tags

Was This Post Helpful? 0
  • +
  • -

#27 HeBTeMy  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 299
  • Joined: 05-October 12

Re: HELP Converting vbScript to Visual basic 2010

Posted 13 February 2013 - 06:26 PM

View PostHeBTeMy, on 11 February 2013 - 12:16 PM, said:

View Postandrewsw, on 10 February 2013 - 02:00 PM, said:

Erm, don't you already have the "something"..?

Dim colOperatingSystems = objWMIService.ExecService("SELECT I can't be bothered typing the rest")


You're right, i was confusing it with the other... my bad.

Now, i'm getting this warnings, and when i run it and click the button it shows http://img198.images...65/errorwep.png
Posted Image

Any help?


I'm sorry, didn't notice the error is in my main language... what it says is "It's not possible to create an ActiveX component
Thanks btw.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2