Question dlookup in Visual Studio 2008

ccman

New member
Joined
May 5, 2009
Messages
2
Programming Experience
Beginner
I've been coding in VBA and now I would like to start learning Visual Studio 2008. The problem is that it is very easy to find solutions to vba questions, but in my first Visual Studio application, I've hit a wall first thing and not so easy to find a solution.

In VBA I used the all powerful dlookup function. It seems this function is not available in Visual Studio code.

I created a data source table Vendors.sdf in My Documents with 3 columns VendorID, VendorName, and VendshrtID. my goal is to enter the vendorID in Textbox1 and have the code return the VendorName in Label1 or if I enter the VendShrtID in textbox1 the code return the VendorName in Label1 as well.

can someone tell me how to accomplish a dlookup equivalent in Visual Basic?
 
You have to realize that VB.Net is disconnected from the DataSource unlike VBA. So to do what you're needing here you'll have to create a function that returns the value you're looking for and the function will need to accept the parameters for the query, then inside the function you build the sql query, open the connection, fill a table, close the connection and return the value from the needed column from the first row and that's pretty much it.

Since I work heavily in .Net and VBA (unfortunately) I can tell you right now that you don't want to work in both environments in the same sitting (I try not to in the same day at work), switching back and forth in the same day is fine at first, but after two years you start getting really bad headaches.
 
Back
Top