How do I do this

D

Dib

Hi,

This code is in VB 6 I have converted the code into DOT net 2003.

I need to change this code and some Listbox and combobox.


here is my funvtion code.

If AnyRS.BOF And rs.EOF = True Then Exit Sub

'UPGRADE_WARNING: TypeOf has a new behavior. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1041"'

If TypeOf AnyBox Is System.Windows.Forms.ComboBox Or TypeOf AnyBox Is
System.Windows.Forms.ListBox Then

AnyRS.MoveFirst()

Do Until AnyRS.EOF

If AnyRS.Fields.Count > 1 Then

sRec = AnyRS.Fields(1).Value

nItem = AnyRS.Fields(0).Value

'UPGRADE_WARNING: Couldn't resolve default property of object
AnyBox.AddItem. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'

AnyBox.AddItem(sRec)

'UPGRADE_WARNING: Couldn't resolve default property of object
AnyBox.NewIndex. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'

'UPGRADE_WARNING: Couldn't resolve default property of object
AnyBox.ItemData. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'

AnyBox.ItemData(AnyBox.NewIndex) = nItem

sRec = ""

nItem = 0

Else

'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1049"'

If Not IsDbNull(AnyRS.Fields(0).Value) Then

sRec = AnyRS.Fields(0).Value

'UPGRADE_WARNING: Couldn't resolve default property of object
AnyBox.AddItem. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'

AnyBox.AddItem(sRec)

sRec = ""

End If

End If

AnyRS.MoveNext()

Loop

End If



Thanks

Dib
 
C

Cor Ligthert

Dib,

I tried it using ADODB however it was a lot of work, therefore I stopped,
using ADONET is probably more simple.

Just typed here so see it as a kind of pseudo.
\\\
Dim dt as datatable
dim conn as new XXXconnection("connectionstring see the link bellow")
dim da as new XXXdataadapter("your SQLSTRING",conn)
da.fill(dt)
AnyBox.datasource = dt
AnyBox.displaymember = "Your dbRecName" 'This is case sensitive
AnyBox.valuemember = "Your dbItemName" 'As well case sensitive
///
for the connectionstring
http://www.connectionstrings.com/

XXX stends with SQL server for SQLclient.SQL and with the rest for
OleDB.OleDB

Why not try it?

Cor
 
D

Dib

Thanks for your help

Dib

Cor Ligthert said:
Dib,

I tried it using ADODB however it was a lot of work, therefore I stopped,
using ADONET is probably more simple.

Just typed here so see it as a kind of pseudo.
\\\
Dim dt as datatable
dim conn as new XXXconnection("connectionstring see the link bellow")
dim da as new XXXdataadapter("your SQLSTRING",conn)
da.fill(dt)
AnyBox.datasource = dt
AnyBox.displaymember = "Your dbRecName" 'This is case sensitive
AnyBox.valuemember = "Your dbItemName" 'As well case sensitive
///
for the connectionstring
http://www.connectionstrings.com/

XXX stends with SQL server for SQLclient.SQL and with the rest for
OleDB.OleDB

Why not try it?

Cor
 

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

Top