|
Thanks for the reply Mycroft.
The way you described it in your post sounds like what I am looking for, would you know the name of the project?
Thanks
|
|
|
|
|
Heres a little light reading[^] for you.
It is after all a fairly large and critical area of developing. try wandering through some of these articles and pick the ones most relevant to you.
|
|
|
|
|
Hi all
i have a c# application on minimizing i place it into the system tray.now when the application is in the system tray and the user shutdown the system a log file should be written into a temp folder in c:\ i tried using onshutdown() it is not working, it would be better to say i dont know how to use it in my application plz help me
|
|
|
|
|
Handle the form's closing event. FormClosingEventArgs has a CloseReason property. If it is CloseReason.WindowsShutDown , write log file.
|
|
|
|
|
thanks a lot. it works fine
|
|
|
|
|
Hey, im working on a project and i have to get the name(header text) of selected column in my listbox or textbox from datagridview, when i select any column it shows the name of that column in textbox or listbox.. i'll be very thankful to if you guys kindly help me out in this matter..
im trying to use the code on DataGridViewHeaderClickEvent
"textBox1.Text=dataGridView1.SelectedColumns.ToString();"
|
|
|
|
|
Try this
private void dgData_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
string s = (sender as DataGridView).Columns[e.ColumnIndex].HeaderText;
}
|
|
|
|
|
Thank you so much
it worked & really helped me,
well what if i want to get just all my column header names in a listbox?
|
|
|
|
|
Try:
private void FillColumnNamesListBox()
{
this.namesListBox.Items.Clear();
foreach (DataGridViewColumn col in this.dataGridView1.Columns)
{
this.namesListBox.Items.Add(col.HeaderText);
}
}
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thank you so much henry
it worked (Y)
|
|
|
|
|
Hello, in my windows form app, i have a function that acts as a loop. This function calls other functions and runs through the code.
Example:
Loop()
{
one();
two();
three();
four();
and so on
}
How can i create a 1 second wait time in between each function within Loop()?
There will be many function calls within this Loop() so setting a timer_tick to call a specific function wont work for the rest.
It cannot be Thread.sleep as this is a single thread app.
Thanks!
|
|
|
|
|
Hi,
Plaese try this
Loop()
{
one();
System.Threading.Thread.Sleep(1000);
two();
System.Threading.Thread.Sleep(1000);
three();
System.Threading.Thread.Sleep(1000);
four();
and so on
}
|
|
|
|
|
Hello
Sorry but you did not fully read my question.
Cannot use Thread.Sleep because it is a single thread app.
|
|
|
|
|
Why? Thread.Sleep works also with a single thread application: it blocks the current thread.
It looks to me that you are omitting some details that could be useful for us to help you, can you explain more what your problem is?
|
|
|
|
|
Ok, I thought people would understand that since it is a windows form application, that i would not want it to seize up with a Thread.sleep.
My mistake.
Thanks for the response.
|
|
|
|
|
Oh, ok.
Then you can not do what you want with a single thread: use a BackgroundWorker to run your function.
|
|
|
|
|
Will that work with an ActiveX com object? Because i tried to do A separate thread for the loop and the webbrowser control on my app broke.
|
|
|
|
|
I've used a BackgroundWorker in an ActiveX object written in C# and loaded in a WebBrowser control before, and it worked.
You have obviously to make sure to use Invoke when updating the UI in your separate threads, though.
|
|
|
|
|
|
Hi,
if you only want the one thread, you should use a Windows.Forms.Timer and put your stuff in its Tick handler. It would tick every second, and your code should be done in much less, otherwise you ruin the user experience and really need a second thread (as in a BackgroundWorker).
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Well if i went the timer route, wouldn't i need a timer for each function? Ideally i want to use a timer, but i just cant figure a way on how to do it. There might be 10 or more function calls within my Loop function. Is there a more simple approach to using the timer?
Just to reiterate, my Loop function would look somthing like this:
Loop()
{
One();
Two();
Three()
...
up to 10 or more function calls.
}
The goal is to have about a 1 second wait inbetween each call
Ex:
Loop()
{
One();
Wait 1 second
Two();
...and so on
}
Thanks!
|
|
|
|
|
Hi,
you can't control time if you refuse to use threads, sleeps and timers.
IMO the easiest way is using a timer, and an counter, say (pseudo-code):
timertickHandler() {
switch(counter) {
case 0: One();
case 1: Two();
...
}
counter=(counter+1)%MAXCOUNT;
}
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
Can you try using ThreadPool.QueueUserWorkItem method?
Main Loop method will call method one.
That method will execute code specific to it.Then it will Sleep for 1 second and then it will queue the next method two.
Loop()
{
ThreadPool.QueueUserWorkItem(new WaitCallback(one))
}
private void one(object state)
{
//Add you code here
Thread.Sleep(1000);
ThreadPool.QueueUserWorkItem(new WaitCallback(two))
}
private void two(object state)
{
//Add you code here
Thread.Sleep(1000);
ThreadPool.QueueUserWorkItem(new WaitCallback(three))
}
Thanks,
Pradnya
|
|
|
|
|
Hi Experts,
I have an application in C# where i am calling a .reg file using process class. now i want to send keystroke y first and then i need to wait for next megssage box to appear then send enter to it.
System.Diagnostics.Process.Start(Application.StartupPath + "\\dsnbackup.reg");
SendKeys.Send("{y}");
SendKeys.Send("{ENTER}");
now first ket strok is working fine but not the second one. Because the second window takes some time to appear. Can anybody tell me how can i wait for the window to appear first then send the enter key stroke.
Please Help
Regards,
Paramhans Dubey.
|
|
|
|