473,480 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Multi-row Textbox Data Binding

4 New Member
I am trying to bind fields from the first three records of a query (three records will always be returned by the query) to three textboxes on a windows form.

ex.
Textbox1.text = row1 column1
Textbox2.text = row2 column1
Textbox3.text = row3 column1

another three textboxes would contain the values from the second column
Textbox4.text = row1 column2
Textbox5.text = row2 column2
Textbox6.text = row3 column2

I tried creating three binding sources and using filters but that didnt work and I can't use a datagrid. I was hoping to do this without creating multiple adapters or connections etc.. Any suggestions?
Apr 16 '07 #1
3 1627
Casey
8 New Member
Can you create a datareader from the query and loop through it?

Dim x as Integer = 1
Dim dbConnect as your database connection
dim sqlCommand as your query, dbConnect
Dim dtrStuff as Datareader = sqlCommand .ExecuteReader()

While Not dtrStuff .EOF
if x = 1 then textbox1.text = dtrStuff ("column")
if x = 2 then textbox2 .text= dtrStuff ("column")
if x = 3 then textbox3.text = dtrStuff ("column")
x = x + 1
Next

The exact syntax, of course, you'll need to work out. But the idea should work.

Casey
Apr 16 '07 #2
sekshin8
4 New Member
Thanks for your response but your suggestion isn't exactly what I am looking for since the data isn't bound to the textbox.


Can you create a datareader from the query and loop through it?

Dim x as Integer = 1
Dim dbConnect as your database connection
dim sqlCommand as your query, dbConnect
Dim dtrStuff as Datareader = sqlCommand .ExecuteReader()

While Not dtrStuff .EOF
if x = 1 then textbox1.text = dtrStuff ("column")
if x = 2 then textbox2 .text= dtrStuff ("column")
if x = 3 then textbox3.text = dtrStuff ("column")
x = x + 1
Next

The exact syntax, of course, you'll need to work out. But the idea should work.

Casey
Apr 16 '07 #3
sekshin8
4 New Member
Anyone else?
Apr 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

12
3841
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
3741
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
8131
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
0
624
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
332
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
0
7054
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6918
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6756
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4495
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.