473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how to display multiple records in multiple textboxes

I would like to display the multiple records in multiple textboxes
Following is my tables and data:

tblJan with these data:
col id
1
2
3
col January
10
20
30

now i want to display the value 10 in one textbox and the value 20 in another textbox and so with the value 30 in another textbox..

i am new in vb.net and a help would be greatly appreciated..tnx..
Apr 23 '10 #1
4 12753
semomaniz
210 Expert 100+
Please show us what you have done? With out trying yourself you wont learn any thing. We all can write a piece of code and post it but the idea is to learn from mistakes. Give it a shot and then show us the error you get.

here is what you can do.
  1. Read the data from the database
  2. use foreach loop to go through the data
  3. for each data create a text box and assign the value

Hope this helps
Apr 23 '10 #2
robjens
37
I guess it also depends on if you want to just read this data or actually update, insert and delete too (CRUD). Basically u can pick between typed and untyped DataSet or DataReader... Loop through the data and store the objects in a collection.

Then you create a instance of the System.Windows.Forms class and add a textbox control to the controls collection for every column/value you find. But this has so many problems on the way, you don't want to take this road trust me. For example, how are you going to check what data type it is? Are you always going to take the textbox control or perhaps a checkbox if it's a boolean? Then you might need a Select Case routine to add the correct control to the form. Where are you going to validate the values? Who controls the database itself and prevents someone from adding a 13, 14 or 15th month? Etc etc.

I guess you wish to make a continuous form like in ACC 2003 but no need to do that in .NET. You have inheritance and datagridviews. I suggest, if you use Visual Studio, you try out the wizards that MS gives you. It's easy to make detail views like the wizard in Access (form view) or display as a table in the DataGridView control

Like semomaniz, some more info would be nice :P
Apr 23 '10 #3
hi!..tnx 4 ur reply..these is what i've come up too based on what i've read..but with these codes i cnt display ol d rows in my database..example if i have 3 current data on my database then i should display those on 3 textboxes also..
Expand|Select|Wrap|Line Numbers
  1.  If dt.Rows.Count < 1 Then
  2.             MsgBox("Record not Found", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Search")
  3.         End If
  4.         Me.BindingContext(dt).Position = Me.BindingContext(dt).Count - 1
  5.         Dim dr As SqlDataReader
  6.         dr = cmd.ExecuteReader
  7.  
  8.         While dr.Read
  9.  
  10.             TextBox1.Text = dr.GetValue(0)
  11.             TextBox2.Text = dr.GetValue(1)
  12.              textbox3.text=dr.GetValue(2)
  13.  
  14.         End While
Apr 26 '10 #4
by the way here is my sql query..
Expand|Select|Wrap|Line Numbers
  1. cmd.Connection = conn
  2.         conn.Open()
  3.         cmd.CommandText = "SELECT tblJan.january+tblJan_Abra.january FROM tblJan,tblJan_Abra"
Apr 26 '10 #5

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

Similar topics

2
by: Debbie Davis | last post by:
Greetings, I have a page displaying records in a table across but there are too many records to display and they run off the page, SO I thought I could show five columns with an unlimited number...
5
by: crispy | last post by:
On this page, you'll see that some PubID's are repeated several times: http://www.ihea.info/pages/website/test1.asp That's because some records have more than one attribute. For example, Title...
1
by: mellie | last post by:
Hi there, SQL 2000 database with ASP I've found many things "out there" regarding updating and deleting multiple records with checkboxes but I can't seem to find anything about adding them. ...
7
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
0
by: BobbyChat | last post by:
Is there a way to display more than one record at a time on a popup form? I have a main form that has a button that triggers a popup form that is a continuous form. I am trying to get it to display...
2
by: Omega | last post by:
Hi How do I make my datagrid to display multiple records on a row ? With: <Columns> <asp:TemplateColumn> <ItemTemplate> <td>Blablabla</td>
0
by: qudra | last post by:
Searching multiple records -------------------------------------------------------------------------------- Hi guys. I need ur help. In VB.NET we usually use this code to search the database...
1
by: priyajee | last post by:
Hai all, I have joined two tables.My Query result is having multiple records (ie) 8 Rows and 2 Columns..How can i display that multiple records in richtextbox? Can anyone tell me??
0
by: patakamuri sai | last post by:
How to display the records from sql server in textboxes by using ASP.Net with c#
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.