-
error in code
I'm working on a program and withen it i need to take a value from a textbox in one form to text box in another form
i wrote this code to do this
Code:
Public Class Form4
Dim generator As New Random
MaskedTextBox1.Text = generator.Next(Form3.MaskedTextBox1.Text)
MaskedTextBox2.Text = generator.Next(1111111, 9999999)
i have two text box in form4
in the first one i need to take a value from3 randomally
in the second one i need to generate a random data ..
when i run the code i face a probem, the program tes me that there is an error;
Conversion from string " -" to type 'Integer' is not valid.
Can anybody plz tell me what's wrong ??
I linked the program with my database (access) by new source data
-
Re: error in code
Random.Next Takes an Integer as Input. Check your Maskedinput Text. It may contain - symbol in the Text. You could like removing the - from the Text as
Code:
generator.Next(Form3.MaskedTextBox1.Text.Remove("-",""))
is the One Option