i have code

Protected Sub btn_submitt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_submitt.Click
        Try

        

            If (ddl_Country.SelectedItem.Text = "Select Country") Then
                Me.Label1.Visible = True
                Me.Label1.Text = "Please Select Country"
            Else
                Me.Label1.Visible = False
                Dim n As Int32
                Dim connString As String = System.Configuration.ConfigurationManager.ConnectionStrings("containerConnectionString").ConnectionString


                Dim con As SqlConnection = New SqlConnection(connString)
                con.Open()
                Dim str, str1 As String

               



                '**************************

               

                cmd.Parameters.Add("@sal", SqlDbType.NVarChar).Value = Me.DropDownList1.SelectedItem.Text
                cmd.Parameters.Add("@Name", SqlDbType.NVarChar).Value = Me.txt_name.Text
                cmd.Parameters.Add("@Position", SqlDbType.NVarChar).Value = Me.txt_position.Text
                cmd.Parameters.Add("@Companyname", SqlDbType.NVarChar).Value = Me.txt_cname.Text
                cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = Me.txt_address.Text
                cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = Me.txt_city.Text
                cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = Me.txt_state.Text
                cmd.Parameters.Add("@Country", SqlDbType.NVarChar).Value = Me.ddl_Country.SelectedItem.Text
                cmd.Parameters.Add("@telephone", SqlDbType.NVarChar).Value = Me.txt_Telephone.Text
                cmd.Parameters.Add("@telefax", SqlDbType.NVarChar).Value = Me.txt_telefax.Text
                cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Me.txt_email.Text
                cmd.Parameters.Add("@webaddress", SqlDbType.NVarChar).Value = Me.txt_webaddress.Text
                'cmd.Parameters.Add("@want_visa", SqlDbType.Int ).Value = Me.rd
                'cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Me.txt_email.Text


                'Create a SqlParameter object to hold the output parameter value
                Dim UserIDParam As New SqlParameter("@UserID", SqlDbType.Int)

                'IMPORTANT - must set Direction as Output
                UserIDParam.Direction = ParameterDirection.Output

                'Finally, add the parameter to the Command's Parameters collection
                cmd.Parameters.Add(UserIDParam)



                cmd = New SqlCommand("User_Insert", con)
                cmd.CommandType = CommandType.StoredProcedure
                con.Open()

            
             
                Dim reader As SqlDataReader = cmd.ExecuteReader()


                Dim userid As Int32 = Convert.ToInt32(UserIDParam.Value)





                '    str = "insert into [users]([Sal],[Name],[position] ,[company name],[Address],[city],[state],[country],[telephone],[telefax],[email],[webaddress],[want_visa],[pickDrop] )values  ('" & Me.DropDownList1.SelectedItem.Text & "' ,'" & Me.txt_name.Text & "' ,'" & Me.txt_position.Text & "','" & Me.txt_cname.Text & " ','" & Me.txt_address.Text & "' ,'" & Me.txt_city.Text & "','" & Me.txt_state.Text & "','" & Me.ddl_Country.SelectedItem.Text & "', '" & Me.txt_Telephone.Text & "','" & Me.txt_telefax.Text & "' ,'" & Me.txt_email.Text & "' ,'" & Me.txt_webaddress.Text & "',  " & Me.rdbtn_wantvisa.SelectedItem.Value & " , " & Me.rdbtn_pickDrop.SelectedItem.Value & ") "


                ' str1 = "insert into [user_company]([userid],[id] )values  () "
                

            End If


        Catch ex As Exception
            MsgBox(ex.ToString())
        End Try
i m getting an error Object reference not set to an instance of an object

    End Sub

Mind telling us where you get the error?

ok let me update my problem
i create run time control like this
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged

Dim index As Integer
For index = 1 To RadioButtonList1.SelectedValue
Dim name_tb As New TextBox()
'validator
Dim name_req As New RequiredFieldValidator

name_tb.ID = "name_tb" & index
name_req.ID = "name_req" & index
name_tb.TextMode = TextBoxMode.SingleLine
tabelcell.Controls.Add(name_tb)
'tabelcell add in trow
'trow then added in htmltable
div.Controls.Add(htmltable)
Me.PlaceHolder1.Controls.Add(div)
next
I need to get textbox text when i click on submitt button on form.

i already set div,placeholder etc etc on radio buttonlist click,i just need to recall it .menas need to get it. now

for example i got placeholder like this way

Dim plholder As PlaceHolder = DirectCast(FindControl("PlaceHolder1"), PlaceHolder)
but what about div??

Thanks

i created div like thsi way

Dim newdiv As New HtmlGenericControl("div")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.