I have a DataTimePicker and a ComboBox on a TabControl. They are on Tab2 which is not initially displayed when the form is loaded. There is a button to add a new record on the form and when it is pressed default values are set for many of the controls. However, since these two controls are not visible at the time the subroutine is run to set the default values, the values are never set. Here is my code below. It is fairly simple but how do I set the value of these controls depite them not being shown? Should I set the value on the dataset or tableadapter
Private Sub OrderHeaderBindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrderHeaderBindingNavigatorAddNewItem.Click
Try
Me.OrderHeaderBindingSource.AddNew()
Me.OrderTypeComboBox.SelectedValue = My.Settings.DefaultSalesOrderType
Me.EmployeeComboBox.SelectedValue = My.Settings.DefaultSalesPerson
Me.FOBPointComboBox.SelectedValue = My.Settings.DefaultFOBPoint
Me.OrderDateDateTimePicker.Value = Now
Me.PrepDateTimePicker.Value = Now
Me.RentFromDateTimePicker.Value = Now
Me.RentToDateTimePicker.Value = Now.AddDays(7)
Me.SaleRequiredDateDateTimePicker.Value = Now
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
instead?