472,371 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to dynamically create and bind radio buttons in Windows form - VB.NET

Help,

I need to display radio buttons on a form. The data is from SQL
table: each row in each table is displayed as a radio button. I have
multiple SQL tables so I understand I need to put them each in a
GroupBox. All the examples I saw from the books or from the web show
me how to add static radio buttons at design, or dynamically at run
time but with fixed radio buttons (like from an array).

I need to create radio buttons based on the data I have from my SQL
table. This data could be altered by the users. Therefore, if I
create fixed radio buttons, every time the user add a new row or
delete a row, that means I have to go to change it in design or in
code. It's not a practical practice.

Anybody has any examples or any advices? Thank you.
Nov 21 '05 #1
2 11687
You will have to create the buttons and add the to the form at run time. If
you look in the "designer generated code" you will see what VS does to add a
radio button to the form. You just have to do this for each row you want a
radio button created for. Just remember to adjust the size of your group
box for however many radio buttons you add. If I remember correctly (I
haven't checked this) you have to add the radio button the to the controls
object of the group box. but like I said, check out the designer generated
code for an example of adding a radio button to a form/group box

Hope this helps.
Chris
"James P." <ha*********@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Help,

I need to display radio buttons on a form. The data is from SQL
table: each row in each table is displayed as a radio button. I have
multiple SQL tables so I understand I need to put them each in a
GroupBox. All the examples I saw from the books or from the web show
me how to add static radio buttons at design, or dynamically at run
time but with fixed radio buttons (like from an array).

I need to create radio buttons based on the data I have from my SQL
table. This data could be altered by the users. Therefore, if I
create fixed radio buttons, every time the user add a new row or
delete a row, that means I have to go to change it in design or in
code. It's not a practical practice.

Anybody has any examples or any advices? Thank you.

Nov 21 '05 #2

Chris wrote:
You will have to create the buttons and add the to the form at run time. If you look in the "designer generated code" you will see what VS does to add a radio button to the form. You just have to do this for each row you want a radio button created for. Just remember to adjust the size of your group box for however many radio buttons you add. If I remember correctly (I haven't checked this) you have to add the radio button the to the controls object of the group box. but like I said, check out the designer generated code for an example of adding a radio button to a form/group box

Hope this helps.
Chris
"James P." <ha*********@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Help,

I need to display radio buttons on a form. The data is from SQL
table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put them each in a
GroupBox. All the examples I saw from the books or from the web show me how to add static radio buttons at design, or dynamically at run
time but with fixed radio buttons (like from an array).

I need to create radio buttons based on the data I have from my SQL
table. This data could be altered by the users. Therefore, if I
create fixed radio buttons, every time the user add a new row or
delete a row, that means I have to go to change it in design or in
code. It's not a practical practice.

Anybody has any examples or any advices? Thank you.


Chris,

Thank you for your suggestion. Are there anyway I can write code to
create those radio buttons based on data in SQL so that it
automatically creates the buttons without me manually write code to
create each and every single button for each row (a description field)
in design or "designer generated code"?

Thank you,
James

Nov 21 '05 #3

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

Similar topics

2
by: mortb | last post by:
I create a table containing radiobuttons in client script depending on what choices the user makes. It works fine the radio buttons appear *but* they are *not clickable*. Why? Is there a solution?...
2
by: obsidian8 | last post by:
Hi All, I have looked around for an answer to this question, but haven't found one as of yet. I'm trying to use javascript to dynamically create raido buttons. I am able to create them easily...
4
by: Jared | last post by:
Radio Button or Check Box and Event Procedures I need to insert either radio buttons or check boxes onto my form. I'm not sure which to use, or if there are other options. I am using the buttons...
2
by: Andrew J. Kelly | last post by:
How do you data bind to a group of radio buttons? I can bind to an individual radio button just fine but how do you bind a single field to all the buttons so it works like a Radio button should? ...
2
by: dougawells | last post by:
Hi- I'm wanting to have a set of radio buttons disabled when a form is displayed, then if they check another specific radio button, those would become enabled. I've tried setting it via...
7
by: moksha | last post by:
Hi, I am new to javascript and i am facing a problem in coding. plz help me out. I am using javascript for dynamically creating a table row which contains text boxes and radio...
1
by: castron | last post by:
Hi all, I'm reading user information from Active Directory. I'm allowing the users to search by username from a web form. There will be times when the result will be more than one record. What I'm...
10
by: =?Utf-8?B?UGFycm90?= | last post by:
I have 8 radio buttons on my Windows form but I can only select up to the first 4. If I click on any button beyond the 4th one and then come back into the program again the 4th button is always...
5
by: satyabhaskar | last post by:
hi all, In my web page i have created radio buttons dynamically on to the page .....following is my code string Course, Semester, Section; int rowsCount; string con =...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.