|
Hello,
If I have a messagebox with two buttons OK, and Cancel. How do I catch which button the user presses?
Thank you
|
|
|
|
|
DialogResult result = MessageBox.Show(...);
if(result == DialogResult.OK)
{
}
else if(result == DialogResult.Cancel)
{
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Thank you
That's perfect.
|
|
|
|
|
I have a form with a label (name = labelStatus) that I would like to update during a lengthy process (e.g. while scanning all files on drive - show filename).
<br />
void TimeConsumingMethod()<br />
{<br />
string fileName = "C:\Temp\A.txt";<br />
<br />
labelStatus.Text = string.Format("Searching {0}", fileName);<br />
<br />
<br />
<br />
}<br />
It doesn't seem to update the label until the method finishes. I've tried to invalidate the form after setting the new text, but that really doesn't make a visible difference. How can I accomplish this?
--G
|
|
|
|
|
As far as i know you have to update the label your self:
labelStatus.Text = "The stuff you want";
labelStatus.Update();
or:
labelStatus.Text = "The stuff you want";
labelStatus.Update();
this.Update();
and finally you can write the following before the lenghty process starts:
Application.DoEvents();
Hope it works!
|
|
|
|
|
zagzagzag wrote:
Hope it works!
Thanks -- this worked perfectly.
|
|
|
|
|
How can I set the focus to the tree node when it is right-clicked?
|
|
|
|
|
Listen for the mouse down event. In the mouse down event handler, check if the right mouse button is down. If it is, call treeView.Focus().
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Hello,
I want to import a c# dll in a vc mfc project. can you help me?
Thanks,
mihai
|
|
|
|
|
|
hello
Thanks for ideea. With a tlb file i can import it in a vc mfc project. At compile it create a tlh file (something like a .h file). there i can see my class (from dll), but the problem is that i can't see the methods for this class. how i can use this methods?
i test same with a vb activex dll. there i can import dll directly (don't need tlb file), he create same tlh file, but there i can see class and methods, too. i can used them and it's work.
for c# dll how can i use the methods?
Thanks,
Mihai
|
|
|
|
|
Hello, I am "new" if you will to C# (it was suggested to use it, however I am very familiar with C++ and .NET) and I was wondering if there is a way to play a video that is embedded as a resource. I searched the web and found DirectShow, however this requires a path name. I would like a video to be wrapped up inside the .exe. Is this possible?
Mike - I love to program!
|
|
|
|
|
You should be able to embed the video as a binary resource. VS2005 allows you to put any resource into the application from the IDE, which you should be able to get it out using as a stream of bytes from code.
Once you've got a stream, the Windows Media SDK or DirectShow, or ManagedDirectX, or similar should be able to play the stream.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Unfortunately, I do not have VS2005, just 2003. Would it still apply?
Mike - I love to program!
|
|
|
|
|
Yeah, it can still work. As far as I remember, it was a little difficult getting this to work with 2003 and 2002. Try searching code project or the web for binary resource or embedded resource.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
I can get the file into a stream using reflection, however I can not find a function that will play a video from a stream, but rather from a path name. Is there something I need to download. Thank you very much for your help.
Mike - I love to program!
|
|
|
|
|
I really don't know, as of right now, the .NET framework doesn't provide any way to play video using native .NET, AFAIK. You need some 3rd party software like the ones I mentioned in the previous post. From there, it's a matter of finding the appropriate streaming methods.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
In the end of the day you can just save the stream to a file in a temp folder, play the file and then delete it.
|
|
|
|
|
Hi,
I have a problem. When I change the value in a NumericUpDown control and then leave the control using the tab key (without hitting enter), the change takes effect, but the ValueChanged event doesn't fire. Any way around this?
Thanks
|
|
|
|
|
IIRC there's a loose focus event, use that to do whatever you need done.
|
|
|
|
|
Hello All,
I have DataSet and i need to change the values of some rows in the dataset i used
DataSet.Table[0].Rows[0].ItemArray[0] = newValue;
DataSet.AcceptChange();
But it didnt work
Please help
Hay
|
|
|
|
|
try
DataSet.Table[0].Rows[0][0] = newValue
The ItemArray will be set internally
Live Life King Size
Alomgir Miah
|
|
|
|
|
Thanks Alomgir so much it is working now.
Best Regareds
Hay
|
|
|
|
|
Hi all,
Using the following code under Visual Studio 2005 with .NET beta 2, I am looking for a way for the connection to timeout (in say 5 seconds) if it can't contact the host specified. Any ideas?
---
public string m_GetProcessList(string v_host, string v_processname)
{
string sendback = "";
Process currentProcess = Process.GetCurrentProcess();
Process[] remoteAll = Process.GetProcesses(v_host);
int v_processcount = 0;
string v_processIDs = "";
foreach (Process v_process in remoteAll)
{
if (v_process.ProcessName.ToLower() == v_processname.ToLower())
{
v_processcount = v_processcount + 1;
v_processIDs = v_processIDs + v_process.Id.ToString() + v_process.StartInfo.Arguments.ToString() + ",";
}
}
sendback = v_host + " - " + v_processname + " - " + v_processcount.ToString() + " - " + v_processIDs;
return sendback;
}
---
Thanks all.
Colin Wheeler
Consultant
|
|
|
|
|
I want to bring up a second form to adjust variables on the first form. Any help appreciated! -mutty
|
|
|
|