|
|
|
date: Fri, 20 Jun 2008 18:05:46 -0700 (PDT),
group: microsoft.public.vstudio.development
back
Re: Odd error when setting Textbox.Text in VB2008
On Jun 20, 7:41 pm, silverfox wrote:
> On Jun 20, 6:05 pm, silverfox wrote:
>
>
>
> > I am converting a Smart Device app to a Windows app and I encountered
> > an odd error in my new Windows version. The line that gives me the
> > error is:
>
> > SceneWidth.Text = 180
>
> > where SceneWidth is a Textbox. And the error is: Conversion from
> > string "" to type 'Double' is not valid."
>
> > Even though it didn't make sense because I was converting an Integer
> > to a String and not a String to a Double, I tried this:
>
> > SceneWidth.Text = "180"
>
> > And I get the same error. FWIW, the textbox is preinitialized with a
> > different value.
>
> > So what is the real problem here?
>
> Update on this problem:
>
> It was always failing on the first instruction that referred to the
> particular form that contained the TextBox and was unrelated to the
> TextBox. The problem occurred in the process of instantiating the
> Form. I could not find anything about the form that caused the
> problem but I removed it from the project and created another one that
> I believe is identical to the first. Obviously it is not though,
> because the problem went away. I would like to know what caused the
> error, but now that I am past it, it isn't so pressing.
There is still a mystery. I discovered that setting the Text property
in the constructor of one and only one of the several TextBox causes
this problem. I could find nothing unusual about the TextBox that was
causing the problem, but if I deleted it and copied and pasted
another TextBox, using the Designer, I made the problem go away.
date: Fri, 20 Jun 2008 21:03:01 -0700 (PDT)
author: silverfox
|
|