Page 1 of 1

stupid Textbox help :/

Posted: Tue Jan 18, 2011 10:56 pm
by lesan101
i have 8 textboxes..

and a button, the button will divide what they entered in the textboxes.

but if the person only entered a number on 2 textboxes only.. then the result will be infinite : (

i dont know what do add so that when you divide, it will only divide whatever textbox they used

or

if they used only 2 textboxes, make it so it adds an automatic "1" for every blank textbox.

Re: stupid Textbox help :/

Posted: Tue Jan 18, 2011 11:29 pm
by Zulf
Why do they need to divide 8 numbers?

Re: stupid Textbox help :/

Posted: Tue Jan 18, 2011 11:30 pm
by lesan101
Well because i have an option that they can enable, to divide more then 2 numbers.

Re: stupid Textbox help :/

Posted: Tue Jan 18, 2011 11:32 pm
by mandai
it will only divide whatever textbox they used
You can use sender.Text for that.

Re: stupid Textbox help :/

Posted: Tue Jan 18, 2011 11:40 pm
by lesan101
mandai wrote:
it will only divide whatever textbox they used
You can use sender.Text for that.
i never used sender.text, how would i put it?

Re: stupid Textbox help :/

Posted: Wed Jan 19, 2011 1:06 pm
by mandai
Actually you would use that if the event was being caused by a textbox. But with a button you would probably use code like this:
Code: Select all
        For i As Integer = 0 To Me.Controls.Count - 1
            If Me.Controls(i).GetType().Name = "TextBox" Then
                If Me.Controls(i).Text.Length = 0 Then Me.Controls(i).Text = "1"
            End If

        Next