|
I put a tabcontrol into my form, there are 3 tabpages and I want my user can switch between tabpages by pressing CTrl+tab. How to do this?
Note:my project has a mdiform, when I click menu, the form containing tabcontrol appear but if I press ctrl-tab, nothing happens.
I create new project with single form, add a tabcontrol into my form, when pressing Ctrl-tab everything is OK. Why?
Regards.
|
|
|
|
|
Hi everybody,
What is difference between a local time and a system time, Correct if I am wrong, system time is time of the system server where your computer is connected. So, if I would change system time I need to change the tme on the server. Right? How would you set(change the local time programatically? Also, using DateTime.UtcNow is to get system time? How to change the system time programatically? How to get and set(change) Time Zone? The System is a remote server and can be access through internet. How to cahnge the time at server?
The situation is this, if the application is to be used by say user from another country, they have their own local time and Time Zone Info, and their own system (server) time. I like these to be configurable. I know that to change timezone I need a class and method inside the System.Globalization. Can you help narrow it down or pinpoint it for setting and getting time zone? Also, how to get a list of Time Zone to be displayed in a Combo Box? Is there a method for this?
I am looking a direct method in setting or getting these values.
denpsia
|
|
|
|
|
Hello !
I am developing a Desktop base not Web base application in C# by using Visual Studio 2003 I want to show images in one column of datagrid against each Product Id by using Picturebox which is coming from Database I also want to raise events against the click and mouseover events of each picturebox Moreover I want to edit images too in Database by using "OpenFileDialog" in Datagrid plz tell me how can i do that????
Please also intimate me on my email address "abubakar.malik@gmail.com"
Regards,
AbuBakar
|
|
|
|
|
Is there a way to copy more than 1 textbox to the clipboard? I tried doing individual statements for each textbox but the last one is the only one that shows up.
textBox1.SelectAll();<br />
Clipboard.SetDataObject(textBox11.SelectedText,true);<br />
<br />
textBox2.SelectAll();<br />
Clipboard.SetDataObject(textBox2.SelectedText, true);
I need to copy the contents of 13 textboxes to the clipboard and somehow (if possible)paste them onto a Word document with a line break inbetween each field.
Any suggestions?
Thanks!
Apoc
|
|
|
|
|
How about this...
var content = textbox1.value + textbox2.value+...<br />
clipboard.setDataObject(conten,true);
Hope you get the idea...
<< >>
|
|
|
|
|
You rock!
Thanks so much!
Apoc
|
|
|
|
|
Hi,
After installing C# Express Install I have a COM error in an application.
Additional information: COM object with CLSID {10020200-E260-11CF-AE68-00AA004A34D5} is either not valid or not registered.
The object is the SQLDMO Interop.
How can I register the dll. I tried regsvr32 but a dll entry point error occurs.
Thanks for any help.
Stephen
|
|
|
|
|
I think the sqldmo.dll is replaced with a new sqldmo.dll (came with Express edition)
try finding it from another machine and copy it to System32 folder than
use regsvr32
i hope it works!
|
|
|
|
|
Thanks.
I uninstalled and reinstalled and it is all good now. Teaches me for installing it when I have other work to do.
Should of known better.
|
|
|
|
|
I am trying to figure out how to sent an event or set a callback when a thread finishes its work.
Lets say that I have 3 functions called:
1) GetData1()
2) GetData2()
3) GetData3() Each function depends on the results of the prior function in order to be able to do its work.
These threads cannot block the main application thread.However, GetData1() may block GetData2() and GetData3()
and GetData2() can block GetData3()
Each of these worker threads make calls to and XML server, and when a given thread finishes I need to start the next one.
The threads can take a long time to complete their task, meaning minutes and not milliseconds etc.
How can I know when a previous thread has finsihed?
Thanks
-- modified at 15:10 Wednesday 14th December, 2005
|
|
|
|
|
You can pass a delegate into the various BeginInvoke methods to have a function execute when the thread is done. For example,
ThreadStart method1 = GetData1();
method1.BeginInvoke(myCallbackFunction, null);
...
void MyCallbackFunction(IAsyncResult result)
{
}
Does this help? Or am I not understanding your problem?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
Hehe, stupid of me this is also a solution.
WM.
What about weapons of mass-construction?
|
|
|
|
|
This seems to be what I am looking for.
The snipit you provided doesn't compile, but I can look up the syntax.
|
|
|
|
|
It should compile under .NET 2.0 syntax (where delegates can be inferred from the method passed). If you're not using a C# 2.0 compiler, you'll need to explicitly create the delegates:
ThreadStart method1 = new ThreadStart(GetData1);
AsyncCallback callback = new AsyncCallback(myCallbackFunction);
method1.BeginInvoke(callback, null);
...
void MyCallbackFunction(IAsyncResult result)
{
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
-- modified at 15:40 Wednesday 14th December, 2005
|
|
|
|
|
Thanks that did the trick.
Sorry, but I am still in the stone ages using .net 1.1 and Visual Studio 2003
Thanks again
|
|
|
|
|
Well, it compiles but it doesn't ever call the callback function
Here is my callback function
void MyCallbackFunction(IAsyncResult result)
{
if( result.IsCompleted )
MessageBox.Show( "Callback triggered");
}
Here is how I am calling it
ThreadStart method1 = new ThreadStart(RequestVehicles);
AsyncCallback callback = new AsyncCallback(MyCallbackFunction);
method1.BeginInvoke(callback, null);
Thread tThread = new Thread( method1 );
tThread.IsBackground = true;
tThread.Start();
Have I done something wrong?
-- modified at 17:19 Wednesday 14th December, 2005
|
|
|
|
|
In that code snippet, you're calling RequestVehicles 2 times: once when you call method1.BeginInvoke method, and again when you explicitly create your Thread and call .Start on the thread. Just remove that explicit thread creation, it's redundant. Your code should look like:
ThreadStart method1 = new ThreadStart(RequestVehicles);
AsyncCallback callback = new AsyncCallback(MyCallbackFunction);
method1.BeginInvoke(callback, null);
void MyCallbackFunction(IAsyncResult result)
{
if( result.IsCompleted )
MessageBox.Show( "Callback triggered");
}
Note that if you used
Thread t = ...
t.Start()
it will not call any callback method. Only BeginInvoke does that.
|
|
|
|
|
Thanks I will try that directly
|
|
|
|
|
Sounds rather complex, let me think:
Every process should have some kind of semaphore. GetData2 should call wait on the semaphore of GetData1. GetData1 should call signal on the semaphore it has, so that GetData2 continues. GetData3 should call wait on the semaphore of GetData2 and GetData2 should call signal on the semaphore it has, to let GetData3 continue.
This should work just fine and you dont have to worry about a lot of the synchronisation here There are other ways to do this, but this is by far the simplest solution I can think of.
WM.
What about weapons of mass-construction?
-- modified at 15:21 Wednesday 14th December, 2005 (Fixed some minor spelling issues )
|
|
|
|
|
Although it seems you already found a solution just another question:
If those three threads get executed sequentially (one after the other) why don't you just call all three methods in a single thread?
|
|
|
|
|
|
I used a combination of both tips
ThreadStart method1 = new ThreadStart(DoRequests);
AsyncCallback callback = new AsyncCallback(MyCallbackFunction);
method1.BeginInvoke(callback, null);
void DoRequests()
{
RequestVehicles();
RequestCustomers();
RequestServiceSales();
}
void MyCallbackFunction(IAsyncResult result)
{
if( result.IsCompleted )
{
}
}
Thanks All
|
|
|
|
|
I made a windows form app that executes a query to an Oracle database. It takes about 5 seconds for the query to execute. If a user presses the button and it takes 5 seconds, they might think its not working.
I want to display a message while it executes the query. The whole query is wrapped up in a function called “ConnectToOracle()”. Obviously it is of type void. I tried to make a while loop that did this…
ConnectToOracle();<br />
<br />
While (ConnectToOracle)<br />
<br />
{<br />
<br />
Label1.visible = true; <br />
<br />
}
It gave me an error that said cannot implicitly convert type ‘void’ to ‘bool’.
Is there anyway I can do this??
Thank you!
Apoc
|
|
|
|
|
Alternately put the label display calls inside ConnectToOracle() on either side of the db operations. You should consider doing this in a seperate thread though so it doesn't lock the GUI.
<br />
void ConnectAndShowWait()<br />
{<br />
Label1.visible = true;<br />
<br />
ConnectToOracle();<br />
<br />
Label1.visible = false;<br />
}
|
|
|
|
|
A while clause expects a boolean value. while(somethingIsTrueOrFalse). Since ConnectToOracle is returning void, while won't work.
What you need is a seperate thread of execution to connect to the database, keeping your UI thread alive and functional. To do this:
using System.Threading;
ThreadStart methodToExecute = new ThreadStart(ConnectToOracle);
Thread oracleReaderThread = new Thread(methodToExecute);
oracleReaderThread.Start();
This will keep your UI thread responsive because it's not actually doing anything. The background oracleReaderThread will begin executing in the background.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|