I would like to add a to z buttoms at runtime 6 1386
freddy,
All you have to do is get the char value for "a" or "A" and then loop
from that value to that value plus 25. For each iteration of the loop,
create a button, and label it with the current loop index, cast to a
character.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"freddy" <fr****@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com... I would like to add a to z buttoms at runtime
Hi,
You asked yesterday the same question, with more details even !
This was the answer I gave you yesterday, it's still valid today ;)
Hi,
Do this :
Create a new class ButtonEx : Button
{
char letter;
ButtonEx( char whatLetter){ letter = whatLetter; }
}
then create as many controls as you need :
// CODE TAKEN FROM cody's post
for (char l = 'A'; l<='Z'; l++)
{
ButtonEx b = new ButtonEx( l);
b.Text = l.ToString();
b.OnClick = new EventHandler( letterButton_Clicked); /// <<=== the real
thing
myForm.Controls.Add(b);
}
void letterButton_Clicked( object sender ... )
{
//cast the sender to the new button
ButtonEx clicked = ( ButtonEx) sender;
//access the char
clicked.Letter;
//do as needed
}
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message
news:23**********************************@microsof t.com... I am creating an inventory program, I would like to know how to create A to Z buttons on runtime and than save data to the letter. Like if I hit F I will get all the names that start with F
"freddy" <fr****@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com...I would like to add a to z buttoms at runtime
I have the code to creat the buttons - thanks, but it only creates the a
button and not b,c .. and so on I am using
b.location = new point (x,y);
b.size = new size (x,y);
I forgot the x and y numbers but it is displying just the letter A. I would
like to display them one after the other
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
You asked yesterday the same question, with more details even !
This was the answer I gave you yesterday, it's still valid today ;)
Hi,
Do this :
Create a new class ButtonEx : Button { char letter; ButtonEx( char whatLetter){ letter = whatLetter; } }
then create as many controls as you need : // CODE TAKEN FROM cody's post for (char l = 'A'; l<='Z'; l++) { ButtonEx b = new ButtonEx( l); b.Text = l.ToString(); b.OnClick = new EventHandler( letterButton_Clicked); /// <<=== the real thing myForm.Controls.Add(b); }
void letterButton_Clicked( object sender ... ) { //cast the sender to the new button ButtonEx clicked = ( ButtonEx) sender; //access the char clicked.Letter; //do as needed }
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message news:23**********************************@microsof t.com...I am creating an inventory program, I would like to know how to create A to Z buttons on runtime and than save data to the letter. Like if I hit F I will get all the names that start with F
"freddy" <fr****@discussions.microsoft.com> wrote in message news:6A**********************************@microsof t.com...I would like to add a to z buttoms at runtime
hi
the code I just sent you create all the buttons, jst remember to change the
location as you desire
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message
news:CA**********************************@microsof t.com... I have the code to creat the buttons - thanks, but it only creates the a button and not b,c .. and so on I am using b.location = new point (x,y); b.size = new size (x,y); I forgot the x and y numbers but it is displying just the letter A. I would like to display them one after the other
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
You asked yesterday the same question, with more details even !
This was the answer I gave you yesterday, it's still valid today ;)
Hi,
Do this :
Create a new class ButtonEx : Button { char letter; ButtonEx( char whatLetter){ letter = whatLetter; } }
then create as many controls as you need : // CODE TAKEN FROM cody's post for (char l = 'A'; l<='Z'; l++) { ButtonEx b = new ButtonEx( l); b.Text = l.ToString(); b.OnClick = new EventHandler( letterButton_Clicked); /// <<=== the real thing myForm.Controls.Add(b); }
void letterButton_Clicked( object sender ... ) { //cast the sender to the new button ButtonEx clicked = ( ButtonEx) sender; //access the char clicked.Letter; //do as needed }
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message news:23**********************************@microsof t.com... >I am creating an inventory program, I would like to know how to create A >to >Z > buttons on runtime and than save data to the letter. Like if I hit F I > will > get all the names that start with F
"freddy" <fr****@discussions.microsoft.com> wrote in message news:6A**********************************@microsof t.com... >I would like to add a to z buttoms at runtime
so if I have a button like
b.location = new point (10,25); and I want another one created next to it
so would it be
b.location = new point(10,35);
or can I do someting like
x = 10
y = 25 ++
"Ignacio Machin ( .NET/ C# MVP )" wrote: hi
the code I just sent you create all the buttons, jst remember to change the location as you desire
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message news:CA**********************************@microsof t.com...I have the code to creat the buttons - thanks, but it only creates the a button and not b,c .. and so on I am using b.location = new point (x,y); b.size = new size (x,y); I forgot the x and y numbers but it is displying just the letter A. I would like to display them one after the other
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
You asked yesterday the same question, with more details even !
This was the answer I gave you yesterday, it's still valid today ;)
Hi,
Do this :
Create a new class ButtonEx : Button { char letter; ButtonEx( char whatLetter){ letter = whatLetter; } }
then create as many controls as you need : // CODE TAKEN FROM cody's post for (char l = 'A'; l<='Z'; l++) { ButtonEx b = new ButtonEx( l); b.Text = l.ToString(); b.OnClick = new EventHandler( letterButton_Clicked); /// <<=== the real thing myForm.Controls.Add(b); }
void letterButton_Clicked( object sender ... ) { //cast the sender to the new button ButtonEx clicked = ( ButtonEx) sender; //access the char clicked.Letter; //do as needed }
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message news:23**********************************@microsof t.com... >I am creating an inventory program, I would like to know how to create A >to >Z > buttons on runtime and than save data to the letter. Like if I hit F I > will > get all the names that start with F
"freddy" <fr****@discussions.microsoft.com> wrote in message news:6A**********************************@microsof t.com... >I would like to add a to z buttoms at runtime
Hi,
you would do
y += 25;
Point p = new point(10,35);
for (char l = 'A'; l<='Z'; l++)
{
ButtonEx b = new ButtonEx( l);
b.Text = l.ToString();
b.Location = p;
p.Y+=25;
b.OnClick = new EventHandler( letterButton_Clicked); /// <<=== the real
thing
myForm.Controls.Add(b);
}
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message
news:EA**********************************@microsof t.com... so if I have a button like b.location = new point (10,25); and I want another one created next to it so would it be b.location = new point(10,35); or can I do someting like x = 10 y = 25 ++
"Ignacio Machin ( .NET/ C# MVP )" wrote:
hi
the code I just sent you create all the buttons, jst remember to change the location as you desire
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"freddy" <fr****@discussions.microsoft.com> wrote in message news:CA**********************************@microsof t.com... >I have the code to creat the buttons - thanks, but it only creates the a > button and not b,c .. and so on I am using > b.location = new point (x,y); > b.size = new size (x,y); > I forgot the x and y numbers but it is displying just the letter A. I > would > like to display them one after the other > > "Ignacio Machin ( .NET/ C# MVP )" wrote: > >> Hi, >> >> You asked yesterday the same question, with more details even ! >> >> This was the answer I gave you yesterday, it's still valid today ;) >> >> Hi, >> >> Do this : >> >> Create a new class ButtonEx : Button >> { >> char letter; >> ButtonEx( char whatLetter){ letter = whatLetter; } >> } >> >> then create as many controls as you need : >> // CODE TAKEN FROM cody's post >> for (char l = 'A'; l<='Z'; l++) >> { >> ButtonEx b = new ButtonEx( l); >> b.Text = l.ToString(); >> b.OnClick = new EventHandler( letterButton_Clicked); /// <<=== the >> real >> thing >> myForm.Controls.Add(b); >> } >> >> void letterButton_Clicked( object sender ... ) >> { >> //cast the sender to the new button >> ButtonEx clicked = ( ButtonEx) sender; >> //access the char >> clicked.Letter; >> //do as needed >> } >> >> >> cheers, >> >> -- >> Ignacio Machin, >> ignacio.machin AT dot.state.fl.us >> Florida Department Of Transportation >> >> >> "freddy" <fr****@discussions.microsoft.com> wrote in message >> news:23**********************************@microsof t.com... >> >I am creating an inventory program, I would like to know how to >> >create A >> >to >> >Z >> > buttons on runtime and than save data to the letter. Like if I hit F >> > I >> > will >> > get all the names that start with F >> >> >> >> >> "freddy" <fr****@discussions.microsoft.com> wrote in message >> news:6A**********************************@microsof t.com... >> >I would like to add a to z buttoms at runtime >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jon |
last post by:
Hello,
I have a datagrid and the data in it is dynamically created at runtime...
For iCounter = 0 To dataset.Tables(0).Columns.Count - 1
Dim objbc As New BoundColumn()
With objbc
.DataField...
|
by: John Baker |
last post by:
Hi:
I imagine there are hundreds of responses to this question, but i cant find any on the
site using a search.
How do you change the background color of buttons? I know there must be an easy...
|
by: DS |
last post by:
Anyone know of any downsides of using Transparent Buttons with Labels
behind them?
Thanks
DS
|
by: Klaus Jensen |
last post by:
Hi!
This has been annoying me for a while now, and I can't get it to work It is
really
driving me nuts!
Basicly this simple webapp created to illustrate my problem, renders five
buttons, and...
|
by: nsteele84 |
last post by:
Hi
I need to be able to add buttons to a toolbar at runtime. Is this
possible? If so if anyone has examples I would appreciate it.
Thanks
Nick Steele
| |
by: Neil Wallace |
last post by:
Hi there,
I have an application in which a grid of 100 or more buttons are put on a
form in columns of 10.
All the buttons are within a panel.
They are added in runtime, and so they adopt a...
|
by: Ron |
last post by:
I want to create 10 buttons on a form at runtime, the code below is
only creating one button labeled 1. Any idea what I am doing wrong?
Public Class Form1
Public code(10) As String
Public...
|
by: Ron |
last post by:
Can anyone help me out? I am trying to add buttons numbered one
through 10 at runtime to a form.
I think they are getting added but they seem to be getting stacked one
on top of each other. so...
|
by: remya1000 |
last post by:
hai i'm using Vb.net.
i'm creating 64 dynamic created buttons of 8 rows and 8 columns. And i have 1 Go button, 1 textbox. those were created dynamically. if i enter one number inside textbox and...
|
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...
|
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,...
| |
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...
|
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,...
|
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: 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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |