|
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
|
|
|
|
|
Your my hero
Wanna be god?
I have to press my button twice.
I click once.. noting happens.
I click twice he loads the data
Then I enter other search values
I click once he shows nothing
I click twice he loads the date whit the new values
|
|
|
|
|
I have a button on my Form called Logoff. Since You can choose to logoff via my machine, I want to make it so you can choose to load this application when the another user logs on.. Or I want you to be able to set the application so it automatically starts when you login to windows (even if you shutdown PC)
When you click Logoff you get a message box that says "Do you want this application to appear when a user logs on system?" I want three options:
Yes = When someone else or you log on system (Without shutting down) it will load this application.
No= Logs user off without loading application
Cancel = closes this screen:
How would you do this? Save info to a XML file?
In the end we're all just the same
|
|
|
|
|
Try to use this registry key :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
|
|
|
|
|
hi!
is there a way to read out the assigned eventhandlers of one item and assing them to the event of another item?!
i want to clone a menuitem and need the click eventhandlers to assign them to the cloned menutem too.
thanks in advance!
|
|
|
|
|
Hi
when you add the menu item write this code.
this.menuItem name.Click += new System.EventHandler(this.eventhandler name);
bye
|
|
|
|