|
Hi,
i need to find a "Outlook Task" with a special UserProperty like "id". I know how to find a contact with this property, but this doesn't work with a task.
Contactitem:
Outlook.ContactItem contact = (Outlook.ContactItem)contactItems.Find(String.Format("[Email1Address]='{0}' and " + "[User3]='{1}'", mail_s, master_s));
I need Help please! Thank's a lot
regards
ww
|
|
|
|
|
Hi
When I could change the text at runtime, I think the property was called Capture.
How do you do in Visual Studio 2010?
If I set the button btn's property Text to "By" and try the below
btn.Text="Hi"
nothing happens.
How do I do it nowadays
Many Thanks
Fia
|
|
|
|
|
What do you mean, "Nothing Happens".
If "btn" is a control on your form or webpage(depending on your solution type), then this will change the text shown on the button.
I think that you have not given us a clear picture of your issue. Could you describe it a little more?
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Hi again
What I mean with "nothing happens" is that the button btn's text is still By.Even if the bool folder's property Visible is changed to true. I have tried
I have the code in the buttons click event.
private void btn_Click(object sender, EventArgs e)
{
if (folder.Visible==true )
{
btn.Text = "Hi";
}
else
{
btn.Text = "By";
}
}
I have tried btn.Invalidate(); and Form1.Invalidate(); it didn't help. And I also tried with Refresh() and Update() on both btn and Form1.
Dear KP Lee
I don't understand how to or what you mean I should do
"I fixed that by assigning a delegate in the winapp, running the calculations on another thread and calling the delegate."
Many Thanks
Fia
|
|
|
|
|
I'd try to change the condition to
if (btn.Text == "By") just to try if the Text change works.
If it does, you should investigate how folder.Visible is connected to your button text.
Ciao,
luker
|
|
|
|
|
The other thing to check is that the click event is hooked to the event handler: put a breakpoint on the first line to make sure it is being executed, and then single step through.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Hi
Thanks for your answers.
I have already stepped through the code and it's running as it should, but the button's Text still doesn't change.
I don't understand what to do????.
Many Thanks
Fia
|
|
|
|
|
OK: I took an existing form, and dropped a button on it.
I double clicked the button and in the handler method that came up:
private void button1_Click(object sender, EventArgs e)
{
button1.Text = button1.Text == "Hello" ? "Goodbye" : "Hello";
}
When I ran the app, the button caption was "button1".
When I pressed it the first time, it changed to "Goodbye"
A second click, it became "Hello".
Third click, back to "Goodbye", and round and round.
What am I doing that is different to you, or you doing that is different to me?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Hi
I can't see any difference.
Here is my code.
private void btn_Click(object sender, EventArgs e)
{
if (folder.Visible==true )
{
btn.Text = "Hi";
}
else
{
btn.Text = "By";
}
}
The variable folder is just a bool variable. When I debug my code I can see that it runs as it should, but still the button's Text doesn't change.
I don't know if it has anything to do with the problem, but I have a FileLListbox and a FolderListBox from Alva on the form. Should that be the problem.
Many Thanks
Fia
|
|
|
|
|
Try something quick: Put a breakpoint on the if line of the handler, and change teh button text in the designer to "TEST".
Run your app, and press the button. Look at btn.Text in the debugger - is it "TEST"?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Hi
I tried that and the text is "Test". I tried also to remove all Alva controls, but I still can't change the text on the button.
Thanks
Fia
|
|
|
|
|
So at least we can be absolutely sure that the right button is hooked up - if you replace the handler content with
btn.Text = "WTF!"; and single step over that one instruction, is the text still "Test" or "WTF!" - I'm just wondering if the text is being changed back somewhere else (which would be a weird thing to do automatically)
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Hi
It changes to "WTF" in the code, but after the event. The buttons text is "Test"?????
Thanks
Fia
|
|
|
|
|
Something has got to be changing it back!
Delete it.
Rebuild.
That should give you any errors that refer to it.
If there aren't any, put it back and repeat the above, see if it works.
Either that or you have a PC full of malevolent pixies...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Put a breakpoint in your code in this routine. Search through your code for all instances of the word Test and put breakpoints on them all - each and everyone. Run the program again and note each breakpoint you hit - you must be resetting the text back to Test after you have left this routine.
|
|
|
|
|
Trying that statement shouldn't even compile. Assuming you didn't complete the statement you really used (with a semi-colon,) this will normally cause the button to refresh and show "Hi" (Without quotes) like your other responder said.
You can try to force a refresh with an .Invalidate
Once, I tried to execute complex logic and print intermediate results by modifying text boxes' .Text property. Wanted to know why that wasn't working. Your winapp has to be idle and waiting for a response before it will render the changes.
I fixed that by assigning a delegate in the winapp, running the calculations on another thread and calling the delegate.
|
|
|
|
|
private void btn_Click(object sender, EventArgs e)
{
if (folder.Visible==true )
{
btn.Text = "Hi";
}
else
{
btn.Text = "By";
}
}
Make sure your property folder.Visible is change when click state
btn.Text = folder.Visible?"Hi":By;
folder.Visible=!folder.Visible; // reset state here
TU
|
|
|
|
|
Hi
I am changing the folder to visible or not visible. But nothing is helping me.
Thanks
Fia
|
|
|
|
|
Given all the responses above, clearly something very weird is happening here.
Are you talking about a standard WinForms Button object here ?
Also: what is "folder," exactly: that's an odd name for a Control. And, if "folder" has a boolean "visible" property, you can use it directly : if (folder.Visible) ...
You mention: "I don't know if it has anything to do with the problem, but I have a FileLListbox and a FolderListBox from Alva on the form. Should that be the problem."
Is "folder" by chance an "Alva" control ?
What are the "Alva" controls, and, is it possible your use of them has introduced some kind of modification that is indirectly changing the way other controls behave ?
good luck, Bill
"Science is facts; just as houses are made of stones: so, is science made of facts. But, a pile of stones is not a house, and a collection of facts is not, necessarily, science." Henri Poincare
|
|
|
|
|
Hi
Thanks for all your replies. I have found my error.
I used InitializeComponent(); both in the constructor Form1() and in
Form1_Load(object sender, EventArgs e)
I am so sorry for my misstake, but know it's working as it should
Many thanks
Fia
|
|
|
|
|
Does anyone have a good reference to a site or a book that focus's on custom controls? I have watched all the youtube videos. Also I completed the training at learnvisualstudio's website.
Thanks,
TheChazm
modified 24-Jan-12 15:11pm.
|
|
|
|
|
|
|
If by "custom controls" you mean UserControls in WinForms, I have benefited greatly from Matthew MacDonald's excellent book "Pro .NET 2.0 Windows Forms and Custom Controls in C#"[^].
Yes, that's quite an old book now (2004), but the author goes into many details, such as defining custom design-time adornments, and complex Property Browser selection mechanisms for custom controls, in a way that I have found clearer than any material I have read since.
"Science is facts; just as houses are made of stones: so, is science made of facts. But, a pile of stones is not a house, and a collection of facts is not, necessarily, science." Henri Poincare
|
|
|
|
|
Thank you all! This has been a huge help and I have the guidance I need. Thank you for taking the time helping a stranger
|
|
|
|