|
-
Sep 29th, 2003, 12:25 PM
#1
Thread Starter
Addicted Member
VB6 to VB.Net - "Control.DataSource"
in vb6 i have this working:
VB Code:
rsvar.Open "select * from clients", cn, adOpenKeyset, adLockOptimistic
For Each Control In cad_clientes.Controls
If TypeOf Control Is TextBox Then
Set Control.DataSource = rsvar
End If
Next Control
how can i do the same thing in VB.Net??
Thank you,
Guilherme
-
Sep 29th, 2003, 12:33 PM
#2
Sleep mode
Is cad_clientes the name of the form ? if yes , then just replace it with Me keyword .
-
Sep 29th, 2003, 12:46 PM
#3
Thread Starter
Addicted Member
this code:
VB Code:
rsvar.Open("select * from clientes where fornecedor = 'f' order by nome", cn, adOpenKeyset, adLockOptimistic)
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then
Control.DataSource = rsvar
End If
Next Control
works, but the "Control" word the vb.net doesn´t found!!
-
Sep 29th, 2003, 12:50 PM
#4
Sleep mode
Put this at the first line of the above code :
-
Sep 29th, 2003, 01:20 PM
#5
Or if you have VS 2003:
VB Code:
rsvar.Open("select * from clientes where fornecedor = 'f' order by nome", cn, adOpenKeyset, adLockOptimistic)
For Each ctrl As Control In Me.Controls
If TypeOf Control Is TextBox Then
ctrl.DataSource = rsvar
End If
Next
Although the bigger question is why are you using the old ADO instead of ADO.NET?
-
Sep 29th, 2003, 01:34 PM
#6
Thread Starter
Addicted Member
and how i use ADO.NET?
is there a lot of diference??
it´s better or faster??
i use to program VB6 and Java. I am starting with VB.Net, so probably, i will do a lot code in the wrong way, i mean, i will program not like the thinkers of VB.net excpet we do!!
Thanks a lot,
Guilherme
-
Sep 29th, 2003, 01:44 PM
#7
Sleep mode
Definitely you need a book or some tutorials . Search the forum for some million of links on this issue ...lol
-
Sep 29th, 2003, 02:08 PM
#8
You might try reading the ADO.NEt section here: http://samples.gotdotnet.com/quickstart/howto/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|