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

Home Posts Topics Members FAQ

databinding buttons verticaly

DH
"web develepor here trying to get to grips with winforms"

I have a list of departments for a restaurant menu i.e Booz, Burgers etc and
want to display a vertical list of buttons (depts pulled from db). This
would be done with a repeater control in asp.net

Regards

ER
Apr 18 '07 #1
1 1188
"DH" <sa****@gamesboutique.co.zawrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"web develepor here trying to get to grips with winforms"

I have a list of departments for a restaurant menu i.e Booz, Burgers etc
and want to display a vertical list of buttons (depts pulled from db).
This would be done with a repeater control in asp.net
There might be a solution that uses databinding, but I would do it in
code, creating the buttons in a loop:

SqlCommand cmd = new SqlCommand("Select * from depts", connection);
connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();

int i=0;
while (rdr.Read())
{
string buttonName = rdr("Name").ToString();
Button b = new Button();
b.Text = buttonName;
b.Top = (i++)*(b.Height+5);
b.Left = 5;
Panel1.Controls.Add(b);
b.Click += new EventHandler(MyButtons_Click);
}

rdr.Close();
connection.Close();
Apr 18 '07 #2

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

Similar topics

4
by: Marc-Olivier BERNARD | last post by:
Hi there, I need to create a classic layout like this: ------------------------\ top | ------------------------| | | | left| center |right|
0
by: Phil D | last post by:
Hi all, I am stuck over a few issues and hope some of you can help me out. I'll start with the scenario: I have a form with 2 textboxs and 3 buttons on it. Behind this is a dataset into which...
2
by: John | last post by:
Hi, heres a brief description of what I'm trying to do. I have a sql table named colors that looks like this: color_id color_name 1 blue 2 red 3......... and so...
1
by: Ondrej | last post by:
perhaps someone could help a newbie with his big problem. i have an arraylist with objects (class i made with two properties). and i'd like to bind it to a datagrid. there are 3 buttons on the...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
2
by: Pauly | last post by:
I have a group of three radio buttons on a group box. In my database I have three columns all of data type bit. I want to bind each button so that if it is 1 then it selects the appropriate...
2
by: Jason MacKenzie | last post by:
I have what is probably a simple question. I have a Windows form with some simple databinding going on. I have some navigation buttons like so for the Move First button: ...
1
by: Heather Crow | last post by:
I have a VS.NET 2003 Visual Basic form which keeps hanging. It does not appear to matter what textbox I am on. When trying to edit the field I cannot move focus from this field to another. Clicking...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
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
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
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...
1
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
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...
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
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
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.