|
Ok, thank you very much. I'll try to access the information there.
|
|
|
|
|
No problem
I'd have dug up a code sample for you but all my EPOS code is at home
|
|
|
|
|
Really? Thank you very much. Appreciated if you could share with me your code sample ASAP.
|
|
|
|
|
I have several mouse buttons that on a mouse click they call the same function, but I need to know which button was pressed.
Is there are way to determine this?
private: System::Void btnTmOut_Click(System::Object^ sender, System::EventArgs^ e) <br />
{<br />
...Bunch of code...<br />
if(btn1)<br />
x = 0x0001;<br />
else if(btn2)<br />
x = 0x0001;<br />
...<br />
else if(btn8)<br />
x = 0x0008;<br />
...Bunch of code...<br />
}
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
earlgraham wrote: I have several mouse buttons that on a mouse click they call the same function, but I need to know which button was pressed.
The sender parameter should hold a reference to the button that caused the event to be raised. You should cast it back to a Button before using it. To follow the psuedocode you have in your question, you would want to make sure each button has a distinguishing name and test the Name property. You could also use the Tag property, but you will still end up doing string comparisons.
What is the reason you have all of the buttons going through the same event handler? If each button does something different you are better off sending them to different event handlers. If there is common code (like logging) that needs to occur, refactor that into a separate method and have each event handler call that method at the appropriate time.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Thanks it works great. Here is my final code. This greatly reduces the variables that have to be shared in the class.
private: System::Void btnTmOut_Click(System::Object^ sender, System::EventArgs^ e) <br />
{<br />
...<br />
Button ^btnLocalOnly = (Button^)sender;<br />
...<br />
if(btnLocalOnly->Name == this->btnTmOut1->Name)<br />
x = IO_1;<br />
else if(btnLocalOnly->Name == this->btnTmOut2->Name)<br />
x = IO_2;<br />
else if(btnLocalOnly->Name == this->btnTmOut3->Name)<br />
x = IO_3;<br />
else if(btnLocalOnly->Name == this->btnTmOut4->Name)<br />
x = IO_4;<br />
else if(btnLocalOnly->Name == this->btnTmOut5->Name)<br />
x = IO_5;<br />
else if(btnLocalOnly->Name == this->btnTmOut6->Name)<br />
x = IO_6;<br />
else if(btnLocalOnly->Name == this->btnTmOut7->Name)<br />
x = IO_7;<br />
else if(btnLocalOnly->Name == this->btnTmOut8->Name)<br />
x = IO_8;<br />
else<br />
{<br />
}<br />
...<br />
}
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Thanks Again Colin Angus Mackay
Im using a grid box that has a date and time format in one of the Columns
Im trying to archive a populate
Using vb.net
I placed a grid box on the form
Then I placed 2 textboxes 1 combo box 2 date pickers
I did a data bind so that when I click on a row the combo box shows the record number (pk) Item no of that row clicked
Below that are the
Name (Text box)
Description (text box)
Start date (date pickers)
End Date (date(picker)
How do I populate the name , desc, stdate , endate fields by just using the Item.index of the combo box then just changing the field to update (Which I Know how to do)
Please assist me wilt the population I really think it is difficult because of the date time picker
|
|
|
|
|
i am using dotnet 2003.i am doing my project in vb.net windows application.i have two form in my project.first form is datagrid .In second form label,textboxes and combobox are avilable to save the entering values in datagrid of first form through this 2nd form.my problem is,i want to search a value using combobox.
for example,
in first form,
there are 4 columns named as name,age,rollno,address in datagrid.
values are ramu for namecolumn,24 for age column,42 for rollno column,cbe for address column.now values in datagrid like below
id name age rollno address
1 ramu 24 42 cbe
2 somu 23 32 che
here id is primary key.
in 2nd form,there are 4 label,4 textbox and 1 combobox.textbox arenamed as nametextbox,agetextbox,rollnotextbox,addresstextbox and 1 combobox named as searchcombobox.
now values of name(ramu,somu) are stored in combobox.
my problem is,
in second form,
if i click the value ramu in combobox means,want to display the values of ramu in textboxes.(ie..want to display automatically ramu in nametextbox,24 in age textbox,42 in rollnotextbox,cbe in address textbox)
during runtime in vb.net windows application.so how i automatically display the values of row in each textbox by clicking the values in combobox.plz help me.
|
|
|
|
|
Hi,
I want the user to order a list of items. What I had in mind was a control similar to a ListBox, where the user can click-and-drag items into the order they need. This is a fairly common operation, but I was unable to find a predefined control doing this. Any help?
thanks..
|
|
|
|
|
|
I have a login box with Validation against a Password database
I would like to use the UserNo. in another form
I have menthod
Public sub frmLogin(Byval Userno as String)
dim login as integer
login = Cint(Log)
{ Now how do use that login variable in another form)
|
|
|
|
|
|
|
You are welcome
|
|
|
|
|
Create a property on this form that exposes the user no. The access that property from the other form before closing this one. You only hide the login form when done, and close or dispose it after reading the property.
|
|
|
|
|
That not so helpful But Thanks
Any Code to support your Written disscussion
|
|
|
|
|
It's only not helpful if you choose to not explore what I said.
|
|
|
|
|
If you want to use valid login name on another form after user authentication the you can create a public property on your another form and fill it with the value by accessing it before opening that form.
Ex:--> if you are on "login.cs" and want to open "Admin.cs" then code for admin will have a public property say "UserNo"
Private int userNo;
Public property int UserNo
{
get { return userNo;}
set { userNo = value;}
}
Now on login.cs after user validation
Admin admin = new Admin() (( This depends opn your architecture))
admin.UserNo = login;
admin.ShowDialog();
This way the user no will be available as per code optimization also.
vims
|
|
|
|
|
I have a windows form in C# with some text boxes and a botton control.
I wanted a code piece to guide me to feed an excel sheet from a text box over a button click. To elaborate it, the contents of a text box should go to a particular cell of the Excel work sheet on button click.
A reference to an article that may solve the problem will also do.
Thanks,
Sid
|
|
|
|
|
Hello to everyone. I've a window form application in c++ and i've a button in it.
How can i add the properties that when the mouse is over the control a description of the control is shown?
Thanks for answers regards.
|
|
|
|
|
Catch the MouseOver event
|
|
|
|
|
Hi, thanks for answer.
I'know there's the event onmousehover but i think what i want is different.
when you are on a button,(like start button of windows xp) a yellow rectangle with a help description is shown. How can i do this?
Thanks , regards
|
|
|
|
|
dodoxor wrote: when you are on a button,(like start button of windows xp) a yellow rectangle with a help description is shown. How can i do this?
This piece of code should do for you :
private void startButton_MouseHover(object sender, System.EventArgs e)<br />
{<br />
startButton.BackColor = Color.Yellow;<br />
ToolTip toolTip = new ToolTip();<br />
toolTip.ShowAlways = true;<br />
toolTip.SetToolTip(startButton, "Whatever Message...");<br />
<br />
}
|
|
|
|
|
Thanks a lot is working. I 've also tried to put
ToolTip toolTip = new ToolTip();
toolTip.ShowAlways = true;
toolTip.SetToolTip(startButton, "Whatever Message...");
in the Form_load event and is work too.
Thanks, bye.
|
|
|
|
|
Set tooltip property at design time , if the button is created dynamically then user code to set tooltip property
|
|
|
|