473,770 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sql and dynamic labels...

Hello,

I hope this is the correct group to ask this question. I am fairly new
to programming, but have a gut feeling this is a pretty easy problem
to overcome. I hope I can explain the problem clearly enough.
Using VB.Net 2003 and MySql db.
I have a table (mySql) with the following fields:

main_category| category| sub_category| answer|date

Basically, the data will be along these lines:
Neuro | LOC | Status | answer1|date
Neuro | LOC | Status | answer2|date
Neuro | LOC | Status | answer3|date
Senso| Visi | Clarity | answer1|date
Senso| Visi | Clarity | answer2|date
etc...
I am trying to query the db and create labels in order to present the
user with the data in the following structure:

Main Category
Category
Sub Category
answer1
answer2
answer3
...

Main Category
Category
Etc...

I can create the labels ok, but I can't seem to find a way to
structure the data in the above format on the form for the user to
review.
Here's some code off the top of my head (not at the office right now,
so I will have to go by memory!):

dim myMain as new Arraylist
dim myCat as new Arraylist
dim mySub as new arraylist
dim myAns as new arraylist

dim strSql as string = "Select * from Test where date=" & strDate
myCmd = new mySqlcommand(st rSql,myCon)
dim myRead as mysqldatareader = myCmd.executequ ery
do while myRead.read()
myMain.add(myRe ad("main_catego ry"))
myCat.add(myRea d("category")
....same for the other 2 fields
loop
myCon.close

dim myLabel as new label
for i = 0 to myMain.count - 1
myLabel = new label
myLabel.text = myMain(i)
myLabel.locatio n = new system.drawing. point(x,y)
me.controls.add (myLabel)

myLabel = new label
myLabel.text = myCat(i)
myLabel.locatio n = new system.drawing. point(x,y + 10)
me.controls.add (myLabel)
y += 20

....Then the sub categories
....then the answers...
next

Now, this is where things get a little tricky. As you can see from the
db, these arrays will be of different lengths, but I need to keep the
answers "aligned" with the Main Categories, Categories, and
Subcategories. Could someone please show me the light? Is it the way I
have structured the table, or does the answer lie elsewhere? Any help
will be greatly appreciated!

Thanks!!

Frank
Dec 2 '05 #1
1 1490

No takers??

On Thu, 01 Dec 2005 18:34:26 -0800, Frank <no****@noreply .com> wrote:
Hello,

I hope this is the correct group to ask this question. I am fairly new
to programming, but have a gut feeling this is a pretty easy problem
to overcome. I hope I can explain the problem clearly enough.
Using VB.Net 2003 and MySql db.
I have a table (mySql) with the following fields:

main_categor y| category| sub_category| answer|date

Basically, the data will be along these lines:
Neuro | LOC | Status | answer1|date
Neuro | LOC | Status | answer2|date
Neuro | LOC | Status | answer3|date
Senso| Visi | Clarity | answer1|date
Senso| Visi | Clarity | answer2|date
etc...
I am trying to query the db and create labels in order to present the
user with the data in the following structure:

Main Category
Category
Sub Category
answer1
answer2
answer3
...

Main Category
Category
Etc...

I can create the labels ok, but I can't seem to find a way to
structure the data in the above format on the form for the user to
review.
Here's some code off the top of my head (not at the office right now,
so I will have to go by memory!):

dim myMain as new Arraylist
dim myCat as new Arraylist
dim mySub as new arraylist
dim myAns as new arraylist

dim strSql as string = "Select * from Test where date=" & strDate
myCmd = new mySqlcommand(st rSql,myCon)
dim myRead as mysqldatareader = myCmd.executequ ery
do while myRead.read()
myMain.add(myRe ad("main_catego ry"))
myCat.add(myRe ad("category")
...same for the other 2 fields
loop
myCon.close

dim myLabel as new label
for i = 0 to myMain.count - 1
myLabel = new label
myLabel.text = myMain(i)
myLabel.locati on = new system.drawing. point(x,y)
me.controls.ad d(myLabel)

myLabel = new label
myLabel.text = myCat(i)
myLabel.locati on = new system.drawing. point(x,y + 10)
me.controls.ad d(myLabel)
y += 20

...Then the sub categories
...then the answers...
next

Now, this is where things get a little tricky. As you can see from the
db, these arrays will be of different lengths, but I need to keep the
answers "aligned" with the Main Categories, Categories, and
Subcategorie s. Could someone please show me the light? Is it the way I
have structured the table, or does the answer lie elsewhere? Any help
will be greatly appreciated!

Thanks!!

Frank


Dec 2 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1952
by: pizzy | last post by:
PROBLEM: I CAN'T GET THE LAST RESUTS TO WORK CORRECTLY. I WOULD PROVIDE THE CODE (AND WILL IF REQUESTED). BUT IN MY OWN WORDS I AM TRYING TO HAVE THE FIRST FORM DYNAMICALLY CREATE INPUT BOXES BASED ON THE NUMBER ENTERED. THEN ON THE SECOND FORM (WHICH IS CREATED BY THE FIRST FORM CALLING A FUNCTION) I WANT THE USER TO BE ABLE TO CLICK ON ONE OF THE CHECKBOXES AND SEE MORE INPUT BOXES APPEAR. HAS ANYONE DONE SOMETHING LIKE THIS? IF SO,...
5
8830
by: hzgt9b | last post by:
Is it possible to dynamically add controls (speciifcally System.Windows.Forms.ProgressBar and System.Windows.Forms.Label) to a panel to a form and have them display (and fucntion) at run time? I've been trying todo this by creating arrays of progressbars and labels. Then for each item in the root nods of a treeView that I need to track progress on, I create a bar and label and add them to a panel. The problem is that when I display the...
1
17673
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
1
5164
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
1
1827
by: Mike Collins | last post by:
I have a web form that has most of the UI designed. On this form, some of the labels, textboxes, dropdowns, etc. will be added dynamically, depending on what extra bits of data the user decides they want to see. The question I have is when retrieving the dynamic fields for my form, should I get everything in one grab (dynamic fields and data) or keep the form dataset separate from the actual data dataset? Also, please excuse my ignorance,...
1
5532
by: nsvmani | last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It would be great , if i know how to create the dynamic HREF links like it should be getting different document based on each userid. Here is my part of jsp code for your reference: <%@ page...
8
2518
markryan57
by: markryan57 | last post by:
Greetings, I searched for this, but cannot find exaclty what I am looking for. I am trying to dynamically create labels on a form just before it opens. I am reading from a database, building the labels then opening the form. Currently I have put the labels (in a control array) on the form I want to receive the variables. Then I create a loop to read in the db and build the labels, then open the form. I have like 300 control arrays to...
2
1272
by: anniejacob | last post by:
hi, I am making a dynamic form which i have to put some labels which r 2 b dynamic.n i have to make 'n' number of labels dynamically. label me = new label(); This is the line im using to make it. how do i pass the value of 'n' in the code. if someone can help me 2 do this.
1
2211
by: dazzler | last post by:
I have application which creates data table from loaded data, table cells are created using labels. I am trying to do following: when the mouse cursor is over the one label it will be highlighted using brighter background color def mouse_enter(event): self.label = "#FFFFFF" def mouse_leave(event): self.label = "#888888"
2
1400
by: bharathi228 | last post by:
my code for retrieving values from database Dim da As New SqlDataAdapter("select parameter_name,parameter_units from sys_params", con) If con.State = ConnectionState.Closed Then con.Open() End If Dim ds As New DataSet Dim name, unit ,namunt As String da.Fill(ds, "sys_params")
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10037
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8931
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.