|
Possibly the easiest way is to use a mutex. I posted a WPF version here[^], but it's easy enough to apply this to a Forms app.
|
|
|
|
|
There are countless articles on CodeProject providing solutions to your problem.
|
|
|
|
|
Hi,
actually none of those "solutions" do what the OP asks. At best they make the second
instance die rapidly, but they don't prevent it from starting up.
|
|
|
|
|
From what I have seen, most are the same, and I use the same thing in my applications too:
1. Create Mutex.
2. Check Mutex, then use IPC (with Remoting) to talk and do what you need with either instance.
|
|
|
|
|
In my code I am going to hide my active form and show another form. In that case are there any way to check me that other(2nd) form is loaded or not, Something like to check null or not.
Because currently I am facing for a problem that is sometime my form going crashed and nothing display, at the same time my other form is already hide. Then my application is something like losen(hang). I j’t want a solution for that.
|
|
|
|
|
ASysSolvers wrote: sometime my form going crashed and nothing display,
your best fix is to fix the code in this form.
Also, a good solution is to have both forms as controls and show them on the one form.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
In the code in the first form that displays the second form, after declaring the second form's instance but before calling show() subscribe to the second form's Shown event. Then, in the handler, hide the first form.
Form2 f2 = new Form2();
f2.Shown += new EventHandler(f2_Shown);
f2.Show();
void f2_Shown(object sender, EventArgs e)
{
Hide();
}
Dave
|
|
|
|
|
does someone know this code??
Record 9 of 10
this ^ is output on a label..
counting all the record on the database then displaying it like that..
|
|
|
|
|
hello.... is not a valid subject, it doesn't help us to work out if we can help, which is the purpose of a subject.
How are you displaying these records, in a grid, or otherwise ? If you have a dataset, then you can get a total from the Count of the rows in it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
sorry about the subject name. the records are displayed on the textboxes..
i also have another table which is in datagridview.
|
|
|
|
|
If you're showing one at a time, then keep track of which one you;re showing, and get the number of total records from the datasource.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
thanks leppie my problem is like this i can get the total number of record from the database, but i want to keep track of the number of records the textbox / datagridview is displaying. so in the label RECORD 9 of 10 which 10 is the total record then 9 is the record on the textbox / datagridview if i move it forward the label must display RECORD 10 of 10.
sorry my english is bad so i cant explain it well..
im just new in c# and i have this project working on without me training in c#.
thanks..
|
|
|
|
|
Hi guys
I hoep someone can help me out here.
I have a C# app that runs on my development machine (WinXP with VS2005) and plays a flash (.swf) file.
On the target machine which is a vanilla Win2K machine, I have installed Flash v9.0.124.0 and registered the flash.ocx file. I can play the swf in IE, but my application does not play.
Have I missed something?
Any help will be appreciated
Thanks
Paresh
Paresh Solanki
"To the world, you may be just one person, but to one person, you may be the world"
|
|
|
|
|
Did you get an error message? Did you try debug it on the Win2k PC? Does the eventlog give you any hints?
|
|
|
|
|
nothing, just a blank page where the swf should be playing.
My test app has a web browser and the flash object on the form, both pointing to the same file.
it plays in the web browser part, but not in the flash object part.
Paresh Solanki
"To the world, you may be just one person, but to one person, you may be the world"
|
|
|
|
|
Sorry, cant help. Perhaps MSDN forums will provide an answer.
|
|
|
|
|
Found the problem
The flash installer creates puts some files in
system32\Macromed\Flash and one of these files is
NPSWF32_FlashUtil.exe , which should be run. This file then downloads some additional files into the
system32\Macromed\Flash directory and registers the correct version of
Flash.ocx
Why can't they put this all into the main installer?
This cockeyed install means I cannot install flash in unattended mode on my target machines, and they must be connected to the internet for flash to install!
Paresh Solanki
"To the world, you may be just one person, but to one person, you may be the world"
|
|
|
|
|
Hi,
This question may be a bit silly, but I still can't figure it out:
When entering a DataGridView DoubleClick event handler function (DataGridView1_DoubleClick(object sender, EventArgs e), e only has basic methods (Equals(), ToString() etc.).
However, at run time, e also have a 'Location' field, which I need. If I try to compile a code contains e.Location, it won't compile...
At google I found people that use e.RowIndex, but I don't have that one either...
Please help.
Thanks!
|
|
|
|
|
check whether u have imported all the files related to DataGridView properly.
rahul
|
|
|
|
|
Using VS2008 I have the same thing, e has very few methods. I got aroung it by this:
DataGridViewRow curRow = datagridview.CurrentRow;
I could then use all the columns etc from curRow.
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
On double clicking on the grid, the event invoked is:
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
this gives RowIndex and ColumnIndex, whereas you will get e.location under the mouse click events, such as:
Private Sub DataGridView1_CellMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
End Sub
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
hi all,
i have a huge problim i have been asked to devolep a small project to log errors and exceptions on widows EventLog and i have no privalge on it can any body help me on this .
i tryed
<assimbly:eventlogprivalge(securityaction.assert)>
and it dosent worked!
thx
|
|
|
|
|
AFAIK you only need elevated permissions for creating a new log, not reading from or writing to an existing one.
MSDN[^]
Dave
|
|
|
|
|
Dave,
i know how to create and write event but the problem i dont have a privlage to do that ,
i tried too many ways the problem stills.
thanks for trying to help me
|
|
|
|