Lock in DSA or Webservice

Topics: CAB & Smart Client Software Factory
Sep 28, 2007 at 2:39 PM
Hi Everyone,

I tried to appropiate a normal string to a TextBox. But when I debug the program, it got an error. I dont know what it is in English, perhaps something like 'violation of timelimit'?
The debugger cancels after this instruction.

Is there something like a lock? If the service is not available, then some Components cant be appropiated anything?
Thanks for help,

Hauke
Sep 28, 2007 at 4:47 PM
Could you post a code sample?
Sep 28, 2007 at 7:43 PM
How many code do you need?

textBox1.Text = "hello";

This doesnt work. Everytime I want to appropiate a string to a TextBox that doesnt work.
Sep 28, 2007 at 8:16 PM
I was actually wondering more where in the process you're working with the textbox and getting the error.

Based on your using a web service and the translation of the exception you're getting, I'm wondering if you might be accessing the textbox in the callback from an asynchronous web service call (which would cause a threading exception) or if the call to the web service itself is timing out (which sort of sounds like it might fit "violation of timelimit").
Sep 29, 2007 at 10:27 AM
I wrote a method 'SetText()' in the view-class and I invoke this method in the callback-class.
Sep 29, 2007 at 3:41 PM
Are you checking InvokeRequired and using BeginInvoke to get back on the UI thread?

The callback will be executed on a background thread and only the UI thread can access its controls.

private delegate void SetTextDelegate(String value);

public void SetText(String value)
{
if(this.InvokeRequired)
this.BeginInvoke(new SetTextDelegate(innerSetText), new object[] { value });
else
innerSetText(value);
}

private void innerSetText(String value)
{
_textbox.Text = value;
}