|
Have the container for yours value. Check my sample as having click event. The current position mouse becomes 0,0 and then you can move.
But if you want to prgramaticly move mouse then i dont know. I will try look into MSDN Library
|
|
|
|
|
|
Hello!
I have a class with a bunch of properties. Sometimes I only have a string for which property I should set. Is there some smart way to copy how datatable["NameofDataColumn"] works? So I can call my class´s property as I´ve done in subject-text?
/regards
|
|
|
|
|
|
|
I was reading this article[^]
And is it possible to use additional modifier "fn" that laptop has?
And how to detect diffrance betwen left and right modifier?
And yes i am using Net Framework 3.5 with C#. I am using Interops services to wrap native dll calls.
|
|
|
|
|
Hi all I'm trying to get my app to read in all contacts in the contact folder of Outlook.
code
-----------------------------------------------------------------------------------------------
Outlook.ContactItem item = (Outlook.ContactItem)objOutlook.CreateItem(OlItemType.olContactItem);
DataTable dt = new DataTable();
dt.Columns.Add("FirstName");
dt.Columns.Add("LastName");
dt.Columns.Add("CompanyName");
dt.Columns.Add("Email");
dt.Columns.Add("HomePhone");
dt.Columns.Add("WorkPhone");
try
{
objFolder = objNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Debug.WriteLine(objFolder.Items.Count + " Contacts found.");
for (int i=0; i < objFolder.Items.Count; i++)
{
item = (Outlook.ContactItem) objFolder.Items.GetNext();
dt.Rows.Add(new object[] {
item.FirstName,
item.LastName,
item.CompanyName,
item.Email1Address,
item.HomeTelephoneNumber,
item.BusinessTelephoneNumber
});
}
Debug.WriteLine(dt.Rows.Count + " Contacts exported.");
}
catch (System.Exception e)
{
MessageBox.Show(e.ToString());
}
----------------------------------------------------------------------------------------------------
m getting an error system.nullreferenceException for "item".
what to do?
thanks in advance.
|
|
|
|
|
i need the equivalent to System.Windows.Forms.Application.Restart() for console app.
any hint?
thanks
|
|
|
|
|
buchstaben wrote: i need the equivalent to System.Windows.Forms.Application.Restart() for console app.
any hint?
There isn't one. You'll have to write it yourself. All restart does is to start a new instance of the application with the same set of conditions as the original was started within then shut down the current instance.
|
|
|
|
|
hm..in this case, the "new" instance is startet before the old is killed.
i'm not sure right now if this can be a problem, but i'd prefer to avoid this..
|
|
|
|
|
buchstaben wrote: hm..in this case, the "new" instance is startet before the old is killed.
Yes - Which is also how Application.Restart works too. (I naturally assume that you know this already)
buchstaben wrote: i'm not sure right now if this can be a problem, but i'd prefer to avoid this..
Why? You were happy to use Application.Restart if it were available to you.
|
|
|
|
|
Colin Angus Mackay wrote: Why? You were happy to use Application.Restart if it were available to you.
I were happy because I didn't know the behaviour
However, it works now.
|
|
|
|
|
Call Main again - but don't forget to include an exit condition somewhere otherwise you'll end up in an infinite loop.
|
|
|
|
|
calling main again would result in two running applications.
there are some background activities running in my app. in the main thread somewhere i'm waiting until all backgound processes finished. but if a certain time elapsed, i dont want to wait anymore and restart application, since there might be a hangup in any background process.
|
|
|
|
|
buchstaben wrote: calling main again would result in two running applications.
No it wouldn't. It would be the same application but the starting point is called for a second time.
buchstaben wrote: there are some background activities running in my app. in the main thread somewhere i'm waiting until all backgound processes finished. but if a certain time elapsed, i dont want to wait anymore and restart application, since there might be a hangup in any background process.
I'm not sure you are using the word process correctly here. Do you mean process as in a ancillary application (which would be the correct use of the word) or process as in another thread?
If you mean process as in other processes (ancillary applications) then just kill the processes.
If you mean process as in another thread then kill the threads.
|
|
|
|
|
i meant process in the thread context.
so i'm gonna kill all running background threads and return to main.
thanks.
|
|
|
|
|
buchstaben wrote: calling main again would result in two running applications.
No it wouldn't. You're not actually going to create a new process here - why do you think Main would behave differently to any other method, none of which results in a new process?
buchstaben wrote: there are some background activities running in my app. in the main thread somewhere i'm waiting until all backgound processes finished. but if a certain time elapsed, i dont want to wait anymore and restart application, since there might be a hangup in any background process.
This sounds like you are getting a bit confused architecturally. Don't restart the application - just kill the threads (be aware that this is really frowned upon though).
|
|
|
|
|
Pete O'Hanlon wrote: This sounds like you are getting a bit confused architecturally. Don't restart the application - just kill the threads (be aware that this is really frowned upon though).
just killing the threads wouldn't help, since i must ensure each background thread runs every main run.
a main run simply covers invoking all registered background threads, starting a timer and wait for the timer's and threads' ready-events. if both, timer and all threads are ready, start a new main run.
if timer is ready since x seconds, (assuming non-expected exception) the app should ignore the background threads' states and stop current main run. now all background threads have to be killed and invoked again. that's actually what my goal is.
architecturally this should be ok, shouldn't?
|
|
|
|
|
It's me again,
I have two check box. I want to decide on of it enable/disable state depend on other.
Say first one is enable, then the second also enable. If the first disable then the second also disable.
I try to use state change of the first, as follows.
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
checkBox2.Enabled = true;
}
In form load I disable the second checkbox. Say I check the first one and un-check it again. At that time the second checkbox is not disable again. What should I do
Thanks
I appreciate your help all the time...
Eranga
|
|
|
|
|
1) Assign the same event handler for both the chack boxes chaeckedChanged event.
2) checkBox1.Enabled = checkBox2.Enabled ^= true;
But the question is if the first is disabled and you want the second also to be disabled how will you enable them again since you cannot check them again ??
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Beacuse you didn't check the condition for the state of checkbox when you click on it.
So when you click on checkbox1 it will enable the checkbox2 and then it will never be set disable by you.
With Regards
Yogesh Agarwal
|
|
|
|
|
Just need a logic as follows.
if( !checkBox2.Enabled )
checkBox2.Enabled = true;
else
checkBox2.Enabled = false;
Hope it is fine, and sorry for disturbing.
Thanks for all replay
I appreciate your help all the time...
Eranga
|
|
|
|
|
The statement checkBox2.Enabled ^= true does the same thing.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Hi,
you want Checkbox.EnabledChanged event
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
checkBox2.Enabled = this.checkbox1.Enable;
}
Never trouble trouble until trouble troubles you.
|
|
|
|