|
If your form has a Close or Cancel button, you can simply set the form's CancelButton property to that control. You can do it via the Designer.
Regards,
Alvaro
... now you see that evil will always triumph, because good is dumb. - Dark Helmet
|
|
|
|
|
HI !
do you tested it ?
but it didn't work ?
by the way , I have no control button in my form .
REGARDS ,
s_mostafa_h
|
|
|
|
|
Hi!
Yes I tested it!
And it did work!
Let me repeat what I said:
If your form has a Close or Cancel button, you can simply set the form's CancelButton property to that control. You can do it via the Designer.
Regards,
Alvaro
... now you see that evil will always triumph, because good is dumb. - Dark Helmet
|
|
|
|
|
Apparently i have to put a button in my form (but i don't want to do it ).
Regrards !
s_mostafa_h
|
|
|
|
|
I am working on a project developing a computer system for a non-profit. It has been decided by the project team that we would develop a menuing system that more or less tells the user what their options are at all times depending on what part of the system they are in. The menu is divided into 7 different categories and has an icon based menu system. The idea is that when one of those categories is selected all forms that are associated to that category are lined up in a menu on the left hand side of the screen.
Example - Icon 2 Selected
{ Icon Button 1 } { Icon Button 2 } { Icon Button 3 } { Icon Button 4 }
Icon Button 2
Menu Option 1
Menu Option 2__________________WORK AREA - FORMS POP UP HERE
Menu Option 3
Example - Icon 4 Selected
{ Icon Button 1 } { Icon Button 2 } { Icon Button 3 } { Icon Button 4 }
Icon Button 4
Menu Option 1
Menu Option 2__________________WORK AREA - FORMS POP UP HERE
Menu Option 3
Menu Option 4
Anyone ever coded something like this in C# before??? Please Help.
-- modified at 10:51 Monday 20th February, 2006
|
|
|
|
|
I found a convertion of C++ Struct into Class (I forgot where i found it). But then I try to convert a C++ Struct (not same code as i found) for Windows API parameters. But it came out an error that said "Incorrect Parameters".
So when we can convert the C++ Struct into Class and when just convert it into C# Struct ?
Thanks.
Simple mind programmers, I don't need a complicated mind.
|
|
|
|
|
Why do you want to convert a structure into a class? That won't work for C++ interop. You can add a struct as a field in a class. You can also create a class with the same fields as a struct. But you cannot, at runtime, convert a struct to a class.
|
|
|
|
|
Hello,
I have a DataGridView, and one of the columns is ComboBox. I have a collection of items that is a datasource for the ComboBox column. The question is:
If a user selects one of the dropdown items from a ComboBox in one record, then that item from a drop down list in ComboBox will be no longer available in the other records. Do I have to create a custom event to do that (hide the item that is selected already in other row)?
Thank you.
|
|
|
|
|
Hi zaboboa,
Here, one thing you should understand that you have given the DataSource to that particular Column not for a row, so what ever the data is available in that DataSource field will displayed in all the Comboboxes of that Column.
The best solution for your problem is to validate the Data in the SelectedIndexChanged Event.
All the best,
Srinivas.
|
|
|
|
|
I would like to know how to display a message box with an "Are you sure you want to exit?" when someone clicks the close button, therefore the cross button. I managed to do it in a simple button but I think it's different in the close button! Can someone help me please?!
Thanks
Alison
|
|
|
|
|
subscribe to the Closing event on a form, and set the Cancel property = true on the event argument if you dont want to exit.
|
|
|
|
|
Override the OnClosing event of your form:
this.FormClosing += new FormClosingEventHandler(OnClosing);
and use this code:
private void OnClosing(object sender, FormClosingEventArgs e)
{
DialogResult res = MessageBox.Show("Are you sure you want to close the form?",
"Question",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question);
if (res != DialogResult.Yes)
{
e.Cancel = true;
}
}
regards
-- modified at 10:41 Monday 20th February, 2006
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greg, that isn't overriding, that is event subscription. To override, you don't need an event handler:
protected override void OnClosing(CancelEventArgs e)
{
DialogResult res = MessageBox.Show("Are you sure you want to close the form?",
"Question",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question);
if (res != DialogResult.Yes)
{
e.Cancel = true;
}
}
|
|
|
|
|
Yeah, my bad, I mixed up both things. But the code works nonetheless
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
this.FormClosing += new FormClosingEventHandler(OnClosing);
This should be put into the form constructor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Ohh I made it, Thanks a lot people for helping me!
|
|
|
|
|
hello
which class i shoot use to add and get information from register???
bye
|
|
|
|
|
What about the Registry class from the Microsoft.Win32 namespace?
bye
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
if (":PARAM2" != string.Empty)
{
oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value = txtBorgtochtNummer.Text;
}
else
{
oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value = "%";
}
why doesn't he fill up the PARAM2 whit a "%" ?
|
|
|
|
|
if (oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value != string.Empty)<br />
{<br />
oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value = txtBorgtochtNummer.Text;<br />
}<br />
else<br />
{<br />
oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value = "%";<br />
}
Eric Dahlvang-Programmer
|
|
|
|
|
doesn't work
"Possible unintended reference comparison; to get a value comparison cast the left hand side to type 'string'"
|
|
|
|
|
so what happens if you do what it says?
Rmokkenstorm wrote: to get a value comparison cast the left hand side to type 'string'
|
|
|
|
|
if ((string)oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value != string.Empty)<br />
{<br />
oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value = txtBorgtochtNummer.Text;<br />
}<br />
else<br />
{<br />
oracleDataAdapter1.SelectCommand.Parameters[":PARAM2"].Value = "%";<br />
}
Eric Dahlvang-Programmer
|
|
|
|