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

Button1_Click() - place my own arguments?

Hi there. this is my codes in vb6:

private Action as integer

private sub button1_Click(index as integer)
Action = Index
End Sub

private sub picture1_mousedown(button as integer, shift as
integer, x as single, y as single)
if Action = 0 then
// draw a square here
end if

if Action = 1 then
// draw a circle
end if

if Action = 2 then
// draw a fillbox
end if
end sub

Yeah.. something like that...

Any help! How will you code that in c#?

In C#, i think it only can button1_click(object sender,
eventargs e)

Thanks.

Regards,
Chua Wen Ching
Nov 15 '05 #1
1 6538
I would assume that you are using one click event for several buttons in VB
and that each button generates a different "index". Here I would add
ValueButtons to a form (using the source I posted in your message titled
"VB6 Buton.Value") and place this "action/index" value in the Value member
of the button. Then associate each button with the same click event
handler. In the event handler you will have a parameter by the name of
"sender" (type object) which is the button that caused the click event. You
can then typecast this sender to a ValueButton and retrieve the Value
property which will contain your "Action/Index" value.

Of course this is all a best guess since I'm not exactly sure what you are
doing.

Brian Patterson

"Chua Wen Ching" <cw*@cwc.com> wrote in message
news:03****************************@phx.gbl...
Hi there. this is my codes in vb6:

private Action as integer

private sub button1_Click(index as integer)
Action = Index
End Sub

private sub picture1_mousedown(button as integer, shift as
integer, x as single, y as single)
if Action = 0 then
// draw a square here
end if

if Action = 1 then
// draw a circle
end if

if Action = 2 then
// draw a fillbox
end if
end sub

Yeah.. something like that...

Any help! How will you code that in c#?

In C#, i think it only can button1_click(object sender,
eventargs e)

Thanks.

Regards,
Chua Wen Ching

Nov 15 '05 #2

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

Similar topics

9
by: Chuck Anderson | last post by:
I have a function with 7 inputs. The last three have default values. I want to call that function specifying the first four, skip two and then specify the last. I thought I could write this...
1
by: tshad | last post by:
I had a project where I had some code in my Button1_Click procedure and copied it over to a new project (that had the same button name on it) and I couldn't figure out why the event never fired. ...
41
by: Telmo Costa | last post by:
Hi. I have the following code: -------------------------------------- function Tunnel() { //arguments(???); } function Sum() { var sum = 0; for (i=0; i<arguments.length; i++) sum +=...
1
by: peter.mcclymont | last post by:
Hi There, Can you please help me write an in-place function in C++ for reversing a string. What is an in-place function? So what is a non-in-place function in that case to reverse a C++...
7
by: sfeher | last post by:
Hi All, Is there a way to preserve the arguments across functions? I have: <script> function myFirstFunction() { // arguments = 'param1'
36
by: Pacific Fox | last post by:
Hi all, haven't posted to this group before, but got an issue I can't work out... and hoping to get some help here ;-) I've got a base object that works fine with named arguments when called...
7
by: VK | last post by:
I was getting this effect N times but each time I was in rush to just make it work, and later I coudn't recall anymore what was the original state I was working around. This time I nailed the...
2
ADezii
by: ADezii | last post by:
When a call is made to a Sub or Function Procedure, you can supply Arguments in the exact order they appear in the Procedure's definition, or you can supply them in any position by name. To...
4
by: Bali | last post by:
Hi I have an ascx control through which I am calling an aspx page using the following command. Page.ClientScript.RegisterStartupScript(GetType(), "test", "window.open(...)"); Initially I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...

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.