I am trying to populate a textbox with a random number and for the life of me I cant get the textbox to populate... any help?
    Sub Page_Load()
    
    Dim oRandom As New Random()
    Dim iNum As Integer
    iNum = oRandom.Next(1, 100000)
    
    textbox1.text = iNum    
    end sub
I run the page and the textbox is still blank.Is the textbox standalone in the page, or is it nested in a formview?
Can you put anything in the textbox, i.e. textbox.text = "something"
no its not letting me put textbox1.text ="anything" ... I do have it between Form tags...
Im lost
Is it supposed to populate on page load?  If so do you have te call inside an if not isportback...
yea I would like for it to populate on the page load
In that case, on the page load sub, add the following:
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
        'Put all your page load stuff in here including the textbox piece
        Dim oRandom As New Random()
        Dim iNum As Integer
        iNum = oRandom.Next(1, 100000)
        textbox1.text = iNum 
    End If
End Sub
bah Im an idiot... lol... thanks...
Anjari
Subscribe to:
Post Comments (Atom)
 
0 comments:
Post a Comment