By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,693 Members | 1,557 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,693 IT Pros & Developers. It's quick & easy.

Type Conversion in Win2k and XP

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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/de...tionStrict.asp
Ken
-----------------------
"Craig G" <cr**********@yarrasoftware.com> wrote in message
news:eP**************@tk2msftngp13.phx.gbl...
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
Nov 21 '05 #2

P: n/a
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
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eZ*************@TK2MSFTNGP09.phx.gbl...
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/de...tionStrict.asp

Ken
-----------------------
"Craig G" <cr**********@yarrasoftware.com> wrote in message
news:eP**************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.