473,408 Members | 1,786 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,408 software developers and data experts.

Adding buttons programmatically

Hi

I have a form and I add buttons programmatically in de form_Load function

Anybody know how implements de function button_click if in the designer mode the button doesn't exists

Another question

In a datagrid control is posible programmatically do autosize columns

Another

In a listview is possible that when I select a item doesn't view in blue color

Thank

Silvia
Jul 21 '05 #1
12 1865

"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message de
news:D2**********************************@microsof t.com...
Hi,

I have a form and I add buttons programmatically in de form_Load function.

Anybody know how implements de function button_click if in the designer

mode the button doesn't exists?

Inside the function that create the button :
myButton.Click += new EventHandler(iHabeDetectedAClick);

Then, create the function :

private void iHabeDetectedAClick(object sender, EventArgs e)

{

System.Console.WriteLine(The Click Was Detected);

}


Jul 21 '05 #2

"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message de
news:D2**********************************@microsof t.com...
Hi,

I have a form and I add buttons programmatically in de form_Load function.

Anybody know how implements de function button_click if in the designer

mode the button doesn't exists?

Inside the function that create the button :
myButton.Click += new EventHandler(iHabeDetectedAClick);

Then, create the function :

private void iHabeDetectedAClick(object sender, EventArgs e)

{

System.Console.WriteLine(The Click Was Detected);

}


Jul 21 '05 #3
In Visual Basic I have to do the same?

Thank

----- Mathieu Chavoutier wrote: ----
"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message d
news:D2**********************************@microsof t.com..
Hi
I have a form and I add buttons programmatically in de form_Load function
Anybody know how implements de function button_click if in the designe

mode the button doesn't exists

Inside the function that create the button
myButton.Click += new EventHandler(iHabeDetectedAClick)

Then, create the function

private void iHabeDetectedAClick(object sender, EventArgs e

System.Console.WriteLine(The Click Was Detected)



Jul 21 '05 #4
In Visual Basic I have to do the same?

Thank

----- Mathieu Chavoutier wrote: ----
"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message d
news:D2**********************************@microsof t.com..
Hi
I have a form and I add buttons programmatically in de form_Load function
Anybody know how implements de function button_click if in the designe

mode the button doesn't exists

Inside the function that create the button
myButton.Click += new EventHandler(iHabeDetectedAClick)

Then, create the function

private void iHabeDetectedAClick(object sender, EventArgs e

System.Console.WriteLine(The Click Was Detected)



Jul 21 '05 #5
I write in visual basic .net
mybutton.Click = New EventHandler (AddressOf DetectedAClick

private Sub DetectedAClick(ByVal sender as object, ByVal e as EventArgs

I produced an erron in executing mode, its say: An unhandled exception of type "System.InvalidCastException' ocurred i
microsoft.visualbasic.dll. Additional information: Specific cast is not valid

Do you know what is the problema

Thank

----- Mathieu Chavoutier wrote: ----
"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message d
news:D2**********************************@microsof t.com..
Hi
I have a form and I add buttons programmatically in de form_Load function
Anybody know how implements de function button_click if in the designe

mode the button doesn't exists

Inside the function that create the button
myButton.Click += new EventHandler(iHabeDetectedAClick)

Then, create the function

private void iHabeDetectedAClick(object sender, EventArgs e

System.Console.WriteLine(The Click Was Detected)



Jul 21 '05 #6
I write in visual basic .net
mybutton.Click = New EventHandler (AddressOf DetectedAClick

private Sub DetectedAClick(ByVal sender as object, ByVal e as EventArgs

I produced an erron in executing mode, its say: An unhandled exception of type "System.InvalidCastException' ocurred i
microsoft.visualbasic.dll. Additional information: Specific cast is not valid

Do you know what is the problema

Thank

----- Mathieu Chavoutier wrote: ----
"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message d
news:D2**********************************@microsof t.com..
Hi
I have a form and I add buttons programmatically in de form_Load function
Anybody know how implements de function button_click if in the designe

mode the button doesn't exists

Inside the function that create the button
myButton.Click += new EventHandler(iHabeDetectedAClick)

Then, create the function

private void iHabeDetectedAClick(object sender, EventArgs e

System.Console.WriteLine(The Click Was Detected)



Jul 21 '05 #7
Hi Silvia,

Did you know there where dotnet language groups.

By instance
microsoft.public.dotnet.languages.vb
and
microsoft.public.dotnet.languages.csharp

When we have to gues which language and it is wrong is very big.

The questions in this newsgroup are vb:c#:c++:j#

49:49:1,5:0,5

You can tell which language you use here, however I think you can ask these
questions better in a language group there are more people who can answer.

Cor
Jul 21 '05 #8
Hi Silvia,

Did you know there where dotnet language groups.

By instance
microsoft.public.dotnet.languages.vb
and
microsoft.public.dotnet.languages.csharp

When we have to gues which language and it is wrong is very big.

The questions in this newsgroup are vb:c#:c++:j#

49:49:1,5:0,5

You can tell which language you use here, however I think you can ask these
questions better in a language group there are more people who can answer.

Cor
Jul 21 '05 #9
O

Thanks
Jul 21 '05 #10
O

Thanks
Jul 21 '05 #11

"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message de
news:C1**********************************@microsof t.com...
I write in visual basic .net:
Hum, I though it was C#
mybutton.Click = New EventHandler (AddressOf DetectedAClick)

private Sub DetectedAClick(ByVal sender as object, ByVal e as EventArgs)

I produced an erron in executing mode, its say: An unhandled exception of type "System.InvalidCastException' ocurred in microsoft.visualbasic.dll. Additional information: Specific cast is not valid.
Do you know what is the problema?


The compiler sais that one of the arguments is not valid, and that it can't
be casted (change type) the one you give in the one it have.

I can't say more, I don't know VB.

Sorry.
Jul 21 '05 #12

"Silvia" <an*******@discussions.microsoft.com> a écrit dans le message de
news:C1**********************************@microsof t.com...
I write in visual basic .net:
Hum, I though it was C#
mybutton.Click = New EventHandler (AddressOf DetectedAClick)

private Sub DetectedAClick(ByVal sender as object, ByVal e as EventArgs)

I produced an erron in executing mode, its say: An unhandled exception of type "System.InvalidCastException' ocurred in microsoft.visualbasic.dll. Additional information: Specific cast is not valid.
Do you know what is the problema?


The compiler sais that one of the arguments is not valid, and that it can't
be casted (change type) the one you give in the one it have.

I can't say more, I don't know VB.

Sorry.
Jul 21 '05 #13

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

Similar topics

7
by: Mathew Hill | last post by:
I am a beginner to the more technical aspects of Microsoft Access (2000) and was wondering if any one can help. I have 3 buttons on a form which add, delete and search for a record. However, when I...
2
by: BJ | last post by:
Hi, I would like to display different group of buttons at different time depending on the users. So if the user click on Button1 then a group of Buttons related for that group will appear on...
2
by: tshad | last post by:
I have 2 radio buttons set to yes or no: <asp:RadioButton id="RelocateYes" Checked="true" GroupName="Relocate" runat="server" Text="Yes"/> <asp:RadioButton id="RelocateNo" GroupName="Relocate"...
3
by: Silvia | last post by:
Hi, I have a form and I add buttons programmatically in de form_Load function. Anybody know how implements de function button_click if in the designer mode the button doesn't exists? I...
12
by: Silvia | last post by:
Hi I have a form and I add buttons programmatically in de form_Load function Anybody know how implements de function button_click if in the designer mode the button doesn't exists Another...
5
by: Jan Smith | last post by:
I have a C# project that has a tab control with four tab pages. On each tab page is a set of three radio buttons (named radioButton1 through radioButton12). I would like to loop through the radio...
3
by: Andreas Wöckl | last post by:
HI Group! I have to programmatically create a user input form with various Checkbox and RadioButton lists - Beside every List I have to place an image button that is able to reset the...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
1
by: Paddy | last post by:
The problem I am facing is as follows: I am populating an HTML table on my webpage with rows of data from a database. The rows may be sometimes 10 and sometimes say,3. I have two buttons on that...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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...
0
Oralloy
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,...
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
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,...

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.