|
I'll have a look at your post when I'm home from work.
(And I'm getting ready to go just about now)
Bye for now
|
|
|
|
|
ManfredRBihy wrote: I'll have a look at your post when I'm home from work.
(And I'm getting ready to go just about now)
Thank you
Steve
|
|
|
|
|
your problem lies in elisa.respond() . Inside it lies the folowing code: Thread.Sleep(4000); . You use that method in a Timer.Tick event. So even if timer ticks, the event doesn't finish for next event tick
|
|
|
|
|
this is a quick hack:
try a whateverControl.Refresh() before you put your main thread to sleep.
A thread or timer approach is better though as it would keep your app responsive.
|
|
|
|
|
OK, thank you.
Can you see anywhere in my code why it is that the strings are being added together?
For example, if I type:
Hello.
Then I type hello again, it would output as
hellohello.
I have tried to clear the strings atraight after use but no luck.
Thank you
Steve
|
|
|
|
|
stephen.darling wrote: I have tried to clear the strings atraight after use but no luck
stephen.darling wrote: richTextBoxOutput.Text += you += input + ("\n")
two very strange statements.
|
|
|
|
|
Luc Pattyn wrote: two very strange statements.
Maybe so, but this is me we are talking about, you proberbly know by bow how difficult it is to explain things to you.
You would think, as a Biomedical Scientist that I would not have a issue, but when it comes to a new area, for me, it is
I am awaiting delivery of my new book, head first c#, so hopefully I can start learning properly.
Regards,
Steve
|
|
|
|
|
Here's an extremely cheesy hack. It's only merit (if you can call it that) is that it's quick to write. For grins, you can show/hide a marquee style progress bar before/after calling GenerateResponse() to simulate processing.
string GenerateResponse
(string input)
{
DateTime start = DateTime.Now;
int pause = 3000;
while ((DateTime.Now - start).TotalMilliseconds < pause) {
Application.DoEvents();
}
return "Some response based on " + input;
}
/ravi
|
|
|
|
|
You're a dirty, dirty bird!
|
|
|
|
|
Hence the disclaimers.
If all he wants to do is write a fun little app, it'll do. But I would never put anything like this in my freeware or commercial apps.
/ravi
|
|
|
|
|
How about this?
string GenerateResponse
(string input)
{
DateTime start = DateTime.Now;
int pause = 3000;
loop:
if ((DateTime.Now - start).TotalMilliseconds >= pause) {
return "Some response based on " + input;
}
Application.DoEvents();
goto loop;
}
/ravi
|
|
|
|
|
Now that's just sad, so, so sad
|
|
|
|
|
Go on - 5 it. You know you wanna.
/ravi
|
|
|
|
|
If by "5 it", you mean "punch it in the face with my fist", then I'm sure he does want to.
|
|
|
|
|
Having trouble seeing the smilies?
/ravi
|
|
|
|
|
I too was joking (making reference to hands having 5 fingers). Didn't feel the need to taint the joke with an emotion though.
|
|
|
|
|
I aasigned Text to the Textbox from code behind like "Showing <b>"+Test+" </b> message ...";
Its not displaying Test in bold.How can I do this
|
|
|
|
|
Since you refer to 'code behind' your question is probably in the wrong forum. It should more properly be in (at a guess) the ASP or WPF forum.
In Windows Forms programming the TextBox cannot display text styles from tags, only from being assigned a boldened font.
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.”
|
|
|
|
|
If you use classic Windows Form App then you need to use TextBox.Font[^]
In Wpf, it is FontWeight
|
|
|
|
|
I aasigned Text to the Textbox from code behind like "Showing "+Test+" message ...";
Its not displaying Test in bold.How can I do this
|
|
|
|
|
Please try to avoid posting the same question more than once!
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.”
|
|
|
|
|
I'm taking this exam in a little more then a week from now and am searching for some practice questions. I found some and didn't always understand the question so I tried it out. "It didn't work". Really, the code they gave as the answer did not what the question requested.
I'm curious if the source is trustworthy or if I'm going bananas here (or both ) ??
thanks.
below an example of such a question and expected answer:
(apologies for the formatting)
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You write the following code fragment.
<StackPanel TextBox.PreviewTextInput="StackPanel_PreviewTextInput">
<TextBox Name="TxtBoxA"/>
<TextBox Name="TxtBoxB"/>
<TextBox Name="TxtBoxC"/>
</StackPanel>
You create an event handler named StackPanel_PreviewTextInput. You also have a collection of strings named Keywords.
You need to ensure that TxtBoxA and TxtBoxB do not contain any of the strings in the Keywords collections.
Which code segment should you use?
A. private void StackPanel_PreviewTextInput(
object sender, TextCompositionEventArgs e)
{ FrameworkElement feSource = sender as FrameworkElement;
if (feSource.Name == "TxtBoxA" || feSource.Name == "TxtBoxB")
{ foreach(string keyword in Keywords)
{
if(e.Text.Contains(keyword)) { e.Handled = false;
return;
}
}} e.Handled = true;
} }
B. private void StackPanel_PreviewTextInput(
object sender, TextCompositionEventArgs e) {
FrameworkElement feSource = e.Source as FrameworkElement;
f (feSource.Name == "TxtBoxA" || feSource.Name == "TxtBoxB")
f (feSource.Name == "TxtBoxA" || feSource.Name == "TxtBoxB") {
foreach(string keyword in Keywords)
{
if(e.Text.Contains(keyword)) { e.Handled = false;
return;
}
} e.Handled = true;
C. private void StackPanel_PreviewTextInput(
object sender, TextCompositionEventArgs e)
{
FrameworkElement feSource = sender as FrameworkElement;
if (feSource.Name == "TxtBoxA" || feSource.Name == "TxtBoxB")
{ foreach(string keyword in Keywords)
{ if(e.Text.Contains(keyword)) {
e.Handled = true;
return; }
} e.Handled = false;
} }
D. private void StackPanel_PreviewTextInput(
object sender, TextCompositionEventArgs e)
{ FrameworkElement feSource = e.Source as FrameworkElement;
if (feSource.Name == "TxtBoxA" || feSource.Name == "TxtBoxB")
{
foreach(string keyword in Keywords)
{ if(e.Text.Contains(keyword)) {
e.Handled = true;
return;
} } e.Handled = false;
}
}
Answer D is the right answer...
However, following the question I found following to actually do what was requested:
(except when you paste the word in the textbox so even the idea of using this code for the requested functionality is not really ideal)
the problem was that e.Text only gave the typed character and not the entire contents.
private void StackPanel_PreviewTextInput(object sender, TextCompositionEventArgs e){
FrameworkElement feSource = e.Source as FrameworkElement;
if (feSource.Name == "TxtBoxA" || feSource.Name == "TxtBoxB") {
foreach (string keyword in Keywords) {
lbl_info1.Content = e.Text;
if ( ((((TextBox)feSource).Text)+e.Text).Contains(keyword)) {
e.Handled = true;
return;
}
}
e.Handled = false;
}
}
V.
|
|
|
|
|
hi !
I am trying to get the url referer in http handler. all the broweser is giving currect valu except safari. It is null evry time. Can you pleaes tell me how do i get the url referer in safari
Thank you.
|
|
|
|
|
This[^] should be the correct place to ask.
Best wishes,
Navaneeth
|
|
|
|
|
Hello.
I have a form that is a multi page wizard.
It will ask the user for quite a bit informtion, some text, some int values and other.
When it is finished collecting the data, I would like to pass it into a seperate object that will "process" the data, and respond with a string or other value to the main form.
What is the best way to approach this, as all my objects so far have only needed to pass in one or 2 auguments or data values.
Thank you
Steve
|
|
|
|