Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify Default value for a control in VS2008 1

Status
Not open for further replies.

KiaKia

Programmer
Mar 30, 2008
59
US
Hi,
How can I specify a default value for a textbox control in VS2008?
I can not find the "Default" property in the Control's property list.

Anny comment?

Thanks

 
Thanks,
But it did not work.
Here is my situation:
I have a Parent-Child form. The parent has a combo box (ComboBox1),I need to assign the selected value of this combobox as the default value of a column (Column1) of the child grid. So that each time I add a record to the child grid, Culomn1 takes automatically the value of ComboBox1.

Please let me know if there is any way to do that.

Thanks


 
you asked for the default property.
In this situation you have to pass the value to a public variable and assign to the grid's cell
Something like this
Code:
Public Class Form1
    Dim myString As String
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        myString = Me.ComboBox1.SelectedItem
        For x As Integer = 0 To Me.DataGridView1.RowCount - 1
            Me.DataGridView1.Rows(x).Cells(0).Value = myString
        Next

    End Sub
End Class

In this example combobox and datagridview located in the same form.

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thank you man,
It works very well with a little modification.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top