Type Conversion in Win2k and XP

  • Thread starter Thread starter Craig G
  • Start date Start date
C

Craig G

i have the following snippet of code for getting a list of SQL Servers

Dim sqlNameList As SQLDMO.NameList

Dim x As Integer

'Filling Servers Name

sqlNameList = sqlApp.ListAvailableSQLServers

For x = 1 To sqlNameList.Count
cbo_Server.Items.Add(UCase(sqlNameList.Item(x)))
Next



this all runs fine on XP but when you try and run it on Win2k i get an error becuase the combo box expects a string or ordinal, so to get round this i had to do a type conversion. but i was just wondering why i needed to do this on Win2k and not XP?

For x = 1 To sqlNameList.Count

str_Server = CType(sqlNameList.Item(x), String)
cbo_Server.Items.Add(UCase(str_Server))

Next



Cheers,
Craig
 
Hi,

My guess is that option strict in turned on in the win 2000 machine.
Please post your messages in the future in text not everyone can read the
messages when they are in richtext format.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmOptionStrict.asp


Ken
-----------------------
i have the following snippet of code for getting a list of SQL Servers

Dim sqlNameList As SQLDMO.NameList
Dim x As Integer
'Filling Servers Name
sqlNameList = sqlApp.ListAvailableSQLServers
For x = 1 To sqlNameList.Count
cbo_Server.Items.Add(UCase(sqlNameList.Item(x)))
Next

this all runs fine on XP but when you try and run it on Win2k i get an error
becuase the combo box expects a string or ordinal, so to get round this i
had to do a type conversion. but i was just wondering why i needed to do
this on Win2k and not XP?
For x = 1 To sqlNameList.Count
str_Server = CType(sqlNameList.Item(x), String)
cbo_Server.Items.Add(UCase(str_Server))
Next

Cheers,
Craig
 
no cant be that either, option strict on the project itself is turned off.

the Win2k & XP machines that im running it on are test pc's, so only have
the OS & .NET 1.1 framework on them

sorry bout the richtext!

Craig
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top