|
Thanks but I have no problem with catching the form close event, what I would like to do is prevent validation events from being fired when a user clicks on the Control Box close button. By the time the FormClosing event is triggered, the validation events have already happened and I want to avoid that when the ControlBox close is clicked. As an alternative if there is a way to catch the event/message that the user is clicking on the controlbox close button, that too would help me with some validation issues.
|
|
|
|
|
follow the link code is not given but it tells you which messages to catch.
http://www.dotnet247.com/247reference/msgs/7/35820.aspx
Shajeel
|
|
|
|
|
Hi everyone.
I'm developing a Windows Forms MDI application with several forms and user controls inside these forms. In some Error situations the user controls display a MessageBox with some text to the user, indicating the error.
The problem in showing these messages is that after I exit the messageBox window and go back to the application window, some of the ComboBoxes on the user control stop working. They just don't respond to any event, like SelectedIndexChanged for ex.
Any clues? Thanks in advance.
The messageBox display is done like this:
try
{
}
catch(Exception ex)
{
MessageBox.Show(null, ex.Message, "Data Error");
}
and i've also tried (with this refering to the user control):
MessageBox.Show(this, ex.Message, "Data Error");
|
|
|
|
|
You need to be a bit more specific about
joaoafonso wrote: //code to treat user's choice
I'm guessing that you need to revert the combobox back to it's previous or default value, you're probably leaving it with an erraneous value.
(I'm just guessing mind)
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
ok, maybe I need to be more specific...
The code tag where I said the user's choice was treated, isn't called when the selectedIndex on the comboBox changes. Instead there is a Button on the User Control to save some info users enter on several textBoxes, and in case there's an error/exception the MessageBox is displayed in the catch{}.
In some cases the combobox retains its values, I can chose them but the selectedIndexChanged event isn't fired. In other cases the comboBox stops working and doesn't open when I click the drop-down arrow. If I don't display any MessageBox the problem never occurs. Happens only after a messageBox is displayed.
Maybe something happens when the MessageBox closes? Is there some event that is fired? Anyone knows what happens to a messageBox object after the window closes?
|
|
|
|
|
Hmm, if the MessageBox.Show is the only code in the catch block then it's puzzling to say the least. Is there a way that you can check the values without having to check for an exception.
For example rather than doing (this is just an example mind):
try
{
MessageBox.Show(this.listBox.Items[0].ToString());
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
Which would display an error if there is no item at index 0.
Check first:
if (this.listBox.Items[0] == null)
{
MessageBox.Show(@"No item at index 0");
}
else
{
MessageBox.Show(this.listBox.Items[0].ToString());
}
Is that possible, can you validate the combo-box rather than wait for the code to fail?
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
It didn't work either... Does exactly the same as when I catch the exception. I still think there's something happening when the MessageBox is closed, some value being passed to the parent form, or even the MDI form (the parent form's parent), but I'm just guessing now
I've decided to build a form to display the error messages instead of the messageBox, since I have no clue as to why this happens.
This is really really weird. Maybe later if I have enough time, I'll try to reproduce this on a new MdiForm and put it here for anyone interested in testing it.
Thanks a lot for your help Ed!
I'll be posting any developments I have on this...
|
|
|
|
|
I've had a look through the MessageBox.Show code in Reflector and there doesn't seem to be anything obnoxious there. Maybe if I had more to play with I could solve it but get your coding done first, thats the main priority, then we can tackle MS
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
How can i use a masked textbox column in a datagridview for date
================================================================
I am working with Visual studio 2005 and c# 2005.
I have a datagridview which contains a date column and will accept value as 26-04-2006.Initially value will be 00-00-0000.When we press any key it will check value which we entered is number or not.if it is number then it will check for other conditions like
1 the day is greater 32 or not?
2 the month is greater than 12 or not?
3 the year is greater than 2006 or not?..like that.
we have to find in keypress event and cancel each character if it fails.
when we do backspace each value must changed to zeros..
I used masked textbox in datgridview for this but i am facing so many issues for that..
When we editing it will not work properly..the values are getting overlapped with the grid contents and all..i created the masked textbox dynamically in editcontrolshowing event..
if anybody did the same pls help me it is very urgent..
If you have any other solution that are also welcome
thanks in advance,
lee ju
|
|
|
|
|
hello guys,
iam a c# beginner can any one help me how to emmbedd two forms into
a single form.
tahnkyou in advance
|
|
|
|
|
How do you mean?
---
b { font-weight: normal; }
|
|
|
|
|
When i use oledb.oledbconnection,i connect to SQL Server with this connection string :Provider=SQLOLEDB.1; Persist Security Info=False;User ID=sa;Initial Catalog=MDLABS;Data Source=SQL;
But when i use sqlclient sql connection , i cannot connect to sql server.
my sqlclient connection string is
Persist Security Info=False;User ID=sa;Initial Catalog=MDLABS;Data Source=SQL;
What is missing?
|
|
|
|
|
Providing the error you get may go some way to helping people answer your question.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
ex.message = Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
|
|
|
|
|
pretty straightforward error message don't you think? A timout implies that the connection worked fine, but timed out on whatever operation you asked of it!
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
J4amieC wrote: A timout implies that the connection worked fine, but timed out on whatever operation you asked of it!
Unless it was a connection timeout
|
|
|
|
|
Even if it was, that error message implies that the connection string was correct in syntax, but that the connection or operation timed out. I should have been more specific.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. "
how to configure server for remote connections
-- modified at 14:55 Thursday 27th April, 2006
|
|
|
|
|
|
Hi
I have one application i.e webapplication i created setup for that and i loaded in some other system now i want one shortcutkey on the desktop such that when i clicked that shortcutkey automatically it will run the program
|
|
|
|
|
|
Hi,
I am working on C#. I want to know how to display an image one by one at certain interval of time in broswer.Please send me the solution.
Regards
Praveen
|
|
|
|
|
tjpraveen23 wrote: Please send me the solution.
How much do I get for it?
Seriously if you want people to help here then you must ask them a specific problem, we cannot write complete applications for people (unless of course we're paid for it ) since we are giving up our free time to help you, just be grateful for that, we can be a miserable bunch if provoked.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Hello Ed,
I have number of .jpg images as a input.
My user requirement is to display these images one after the other so that its look like playing a video.
One simple solution is to link image one after the other and display it with specific time.
Please suggest me to implement the above solution in C#?
Regards
Praveen
|
|
|
|
|
All you need for a simple solution is a PictureBox for displaying the picture, a timer for changing the pictures that's it.
If you create an array of strings to hold the filenames and another variable to hold the index of the picture that's currently being displayed then the code in the timer's Tick event can be something like this:
private void timer_Tick(object sender, EventArgs e)
{
this.index = ((this.index++) % (this.images.Count));
this.pictureBox.Image = Image.FromFile(this.images[this.index]);
}
Et voila!
Of course this is a quick and dirty solution, you should be able to expand on it.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|