Fordraiders
asked on
placing variable in textbox when adding a new record
sql server express 2005 sp3
vb.net 2008
I have a data collection for with textboxes from sql server table
binding navigator controls on form.
I have a public variable that takes the current value in a textbox and saves it in memory.
When I add a new record...I want this variable to be placed in the same field with the variable value...
Private mlngData1 As Object ' Customer Mfrnumber
when saving a record...
mlngData1 = Me.FldCmfrnumTextBox.Text
when adding a new record...
I then do:
Me.FldCmfrnumTextBox.Selec t()
Me.FldCmfrnumTextBox.Text = mlngData1 ' Customer Mfrnumber
But it will not place the value in the textbox...
Thanks
fordraiders
vb.net 2008
I have a data collection for with textboxes from sql server table
binding navigator controls on form.
I have a public variable that takes the current value in a textbox and saves it in memory.
When I add a new record...I want this variable to be placed in the same field with the variable value...
Private mlngData1 As Object ' Customer Mfrnumber
when saving a record...
mlngData1 = Me.FldCmfrnumTextBox.Text
when adding a new record...
I then do:
Me.FldCmfrnumTextBox.Selec
Me.FldCmfrnumTextBox.Text = mlngData1 ' Customer Mfrnumber
But it will not place the value in the textbox...
Thanks
fordraiders
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Have you assigned a new value to mlngData1 before updating the textbox? Place a breakpoint at the line:
Me.FldCmfrnumTextBox.Text = mlngData1 ' Customer Mfrnumber
to see if the value of mlngData1 has changed.
Me.FldCmfrnumTextBox.Text = mlngData1 ' Customer Mfrnumber
to see if the value of mlngData1 has changed.
ASKER
well, did the breakpoint thing and the value of the textbox in debugger is
"0"...?
But the variable value had not changed..
So instead of assigning the field the value of the variable...its giving it a value of "0" in memory but not placing anything on the form.
Thanks
fordraiders
"0"...?
But the variable value had not changed..
So instead of assigning the field the value of the variable...its giving it a value of "0" in memory but not placing anything on the form.
Thanks
fordraiders
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok lets say I'm at record 36
In the bindingnavigator...I hit "Add Record"
The value in Me.FldCmfrnumTextBox.Text
= "apples"
mlngData1 = Me.FldCmfrnumTextBox.Text
mlngData1 = "apples"
at this point...
Me.FldCmfrnumTextBox.Text = mlngData1
mlngData1 at this point is still "apples"
The variable is holding its value but the textbox simply will not accept the Var(mlngData1) value.
In the bindingnavigator...I hit "Add Record"
The value in Me.FldCmfrnumTextBox.Text
= "apples"
mlngData1 = Me.FldCmfrnumTextBox.Text
mlngData1 = "apples"
at this point...
Me.FldCmfrnumTextBox.Text = mlngData1
mlngData1 at this point is still "apples"
The variable is holding its value but the textbox simply will not accept the Var(mlngData1) value.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
barnesd1,
still a no , but thanks...
I can almost see in a flash the value being placed there but then it gets wiped out.
I have no other events occuring after this statements.
when you are using a binding navigator is there an event that occurs after you a new record is being added.?
In other words the vents that occur after you press the "+" sign on the binding navigator toolbar on the form.
Because no code is there to begin with ?
My "Main id" field on my form shows "-1" , until I press "Save"
Thanks
fordraiders
still a no , but thanks...
I can almost see in a flash the value being placed there but then it gets wiped out.
I have no other events occuring after this statements.
when you are using a binding navigator is there an event that occurs after you a new record is being added.?
In other words the vents that occur after you press the "+" sign on the binding navigator toolbar on the form.
Because no code is there to begin with ?
My "Main id" field on my form shows "-1" , until I press "Save"
Thanks
fordraiders
ASKER
do the databindings have anything to do with the textbox accepting values during a dataset editing ?
ASKER
If I do this:
Me.txtCmfrnum.DataBindings .Clear()
before the record is added...
The value will be placed in in the textbox...
but the problem then is binding back the textbox to the database ?
because this does not completely bind the textbox back.
txtCmfrnum.DataBindings.Ad d("Text", ICart_DataDataSet, _
"tblMainData.fldCmfrnum")
Me.txtCmfrnum.DataBindings
before the record is added...
The value will be placed in in the textbox...
but the problem then is binding back the textbox to the database ?
because this does not completely bind the textbox back.
txtCmfrnum.DataBindings.Ad
"tblMainData.fldCmfrnum")
The textbox you are trying to load into, is that a databound one or a standard textbox. Cos if databound it may get overwritten by what's in the database.
ASKER
its databound...because I'm using the bindingnavigator...
I dragged and dropped my fields from the datasourcde explorer window...
so your saying if in sql server express table the defualt value is set to "Null" it will get overwritten ?
I dragged and dropped my fields from the datasourcde explorer window...
so your saying if in sql server express table the defualt value is set to "Null" it will get overwritten ?
When do you expect the database save/commit to occur. Suggest you post bigger section of code
ASKER
all the code I have thus far in the form is below...
Thanks;
Thanks;
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports System.Windows.Forms.Form
Imports System.Windows.Forms.DataGridView
Imports System.Windows.Forms.Control
Imports System.Windows.Forms.ColumnHeader
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Imports System.Configuration
Imports System.Configuration.ConfigurationSettings
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Diagnostics
Public Class frmEnterpriseCollection
Private con As New SqlConnection
Private dxt As DataTable
Private sql_command As SqlCommand
Private sql_param As SqlParameter
Private dxa As SqlDataAdapter
' daragrid 2
Private con2 As New SqlConnection
Private dxt2 As DataTable
Private sql_command2 As SqlCommand
Private sql_param2 As SqlParameter
Private dxa2 As SqlDataAdapter
' datagrid 3
Private Con3 As New SqlConnection
Private dxt3 As DataTable
Private sql_command3 As SqlCommand
Private sql_param3 As SqlParameter
Private dxa3 As SqlDataAdapter
' datagrid view for scan/num mfgnames in grid
' mfgname ScanNumName
Private sql_param31 As SqlParameter
Private sql_param15 As SqlParameter
Private sql_command15 As SqlCommand
Private sql_command31 As SqlCommand
Private dxa31 As SqlDataAdapter
Private Con31 As New SqlConnection
Private dxt31 As DataTable
' Bring Items Forward
Private mlngData1 As Object ' Customer Mfrnumber
Private mlngData2 As Object ' Customer Mfgname
Private mlngData3 As Object ' Customer Partnumber
Private mlngData4 As Object ' Program
Private mlngData5 As Object ' Unit
Private mlngData6 As Object ' Level
Private mlngData7 As Object ' Position
Private mlngData8 As Object ' Compartment
Private mlngData9 As Object ' Customer Description
Private mlngData10 As Object ' Product Notation
Private mlngData11 As Object ' Site Collector
Private Sub TblMainDataBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblMainDataBindingNavigatorSaveItem.Click
Me.Validate()
Me.TblMainDataBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.ICart_DataDataSet)
SaveForward()
End Sub
Private Sub frmEnterpriseCollection_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
' FORCE UPPER ON ALL CASES
If Char.IsLower(e.KeyChar) Then
e.KeyChar = Char.ToUpper(e.KeyChar)
End If
End Sub
Private Sub frmEnterpriseCollection_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'DataSetCollector.tblCollector' table. You can move, or remove it, as needed.
Me.TblCollectorTableAdapter.Fill(Me.DataSetCollector.tblCollector)
'TODO: This line of code loads data into the 'DataSetMfgname.tblMfgnames' table. You can move, or remove it, as needed.
Me.TblMfgnamesTableAdapter.Fill(Me.DataSetMfgname.tblMfgnames)
'TODO: This line of code loads data into the 'ICart_DataDataSet.tblMainData' table. You can move, or remove it, as needed.
Me.TblMainDataTableAdapter.Fill(Me.ICart_DataDataSet.tblMainData)
' loading datagridview1
' SAP Cross Reference DatagridView1
con.ConnectionString = "Data Source=.\sqlexpress;Initial Catalog=DescMatchGisXref;User ID=sa;Password=veeger"
con.Open()
sql_command = New SqlCommand("get_View_SAP_Data_Grid1", con)
sql_command.CommandType = CommandType.StoredProcedure
sql_param = sql_command.Parameters.Add("@param3", SqlDbType.NVarChar)
dxa = New SqlDataAdapter(sql_command)
' LOADING DATAGRID VIEW2
' Grainger SKU VIEW DATAGRIDView2
con2.ConnectionString = "Data Source=.\sqlexpress;Initial Catalog=WwgExtra;User ID=sa;Password=veeger"
con2.Open()
sql_command2 = New SqlCommand("get_Sku_View_DataGrid2", con2)
sql_command2.CommandType = CommandType.StoredProcedure
sql_param2 = sql_command2.Parameters.Add("@param4", SqlDbType.NVarChar)
dxa2 = New SqlDataAdapter(sql_command2)
' LOADING DATAGRID VIEW3
' gRainger Parts_SKU VIEW DATAGRIDVIEW3
Con3.ConnectionString = "Data Source=.\sqlexpress;Initial Catalog=gPartsFindMro;User ID=sa;Password=veeger"
Con3.Open()
sql_command3 = New SqlCommand("get_GFSku_View_DataGrid3", Con3)
sql_command3.CommandType = CommandType.StoredProcedure
sql_param3 = sql_command3.Parameters.Add("@param5", SqlDbType.NVarChar)
dxa3 = New SqlDataAdapter(sql_command3)
' loading datagridview1
' SAP VIEW GRID1 FOR MFGNAME
Con31.ConnectionString = "Data Source=.\sqlexpress;Initial Catalog=DescMatchGisXref;User ID=sa;Password=veeger"
Con31.Open()
sql_command31 = New SqlCommand("get_ScanNamNum_CollectionScreen", Con31)
sql_command31.CommandType = CommandType.StoredProcedure
sql_param15 = sql_command31.Parameters.Add("@param15", SqlDbType.NVarChar)
sql_param31 = sql_command31.Parameters.Add("@param31", SqlDbType.NVarChar)
dxa31 = New SqlDataAdapter(sql_command31)
' go to the Last Record
Me.TblMainDataBindingSource.MoveLast()
End Sub
Private Sub FldCmfrnumTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles FldCmfrnumTextBox.KeyDown
Dim I As Integer
If e.KeyCode = Keys.Enter Then
e.SuppressKeyPress = True
' Me.Cursor = Cursors.WaitCursor
' e.SuppressKeyPress = True
sql_param.Value = FldCmfrnumTextBox.Text
dxt = New DataTable
dxa.Fill(dxt)
DataGridView1.DataSource = dxt
' NEW CODE ADDED
' GET A RECORD COUNT
i = dxt.Rows.Count
If i = 0 Then
Me.Cursor = Cursors.Default
MsgBox("No Records Found")
End If
Dim s As String
s = Me.ComboBox1.Text
' DataGridView1.Sort(DataGridView1.Columns(s), System.ComponentModel.ListSortDirection.Ascending)
DataGridView1.Sort(DataGridView1.Columns("MFRNUM"), System.ComponentModel.ListSortDirection.Ascending)
If Me.ComboBox1.Text = "MFRNUM" Then
DataGridView1.Sort(DataGridView1.Columns("MFRNUM"), System.ComponentModel.ListSortDirection.Ascending)
End If
If Me.ComboBox1.Text = "MFRNAME" Then
DataGridView1.Sort(DataGridView1.Columns("MFRNAME"), System.ComponentModel.ListSortDirection.Ascending)
End If
If Me.ComboBox1.Text = "XREF" Then
DataGridView1.Sort(DataGridView1.Columns("XREF"), System.ComponentModel.ListSortDirection.Ascending)
End If
' if we do find some records
Me.Cursor = Cursors.Default
If My.Settings.ColumnOrders IsNot Nothing Then
For j As Integer = 0 To My.Settings.ColumnOrders.Count - 1
Dim index As Integer = Convert.ToInt32(My.Settings.ColumnOrders(j))
Me.DataGridView1.Columns(j).DisplayIndex = index
Next
End If
If My.Settings.dgvColumnWidth <> String.Empty Then
Dim x As Integer
For Each col As String In My.Settings.dgvColumnWidth.Split(";"c)
Me.DataGridView1.Columns(x).Width = col
x += 1
Next
End If
sql_param3.Value = FldCmfrnumTextBox.Text
dxt3 = New DataTable
dxa3.Fill(dxt3)
DataGridView3.DataSource = dxt3
Me.DataGridView1.Select()
End If
' needs to be fixed ! october 2010
If Me.chkScanName.Checked = True Then
' e.SuppressKeyPress = True
sql_param15.Value = FldCmfrnumTextBox.Text
sql_param31.Value = FldCmfgnameComboBox.Text
dxt31 = New DataTable
dxa31.Fill(dxt31)
DataGridView1.DataSource = dxt31
If My.Settings.ColumnOrders IsNot Nothing Then
For j As Integer = 0 To My.Settings.ColumnOrders.Count - 1
Dim index As Integer = Convert.ToInt32(My.Settings.ColumnOrders(j))
Me.DataGridView1.Columns(j).DisplayIndex = index
Next
End If
If My.Settings.dgvColumnWidth <> String.Empty Then
Dim x As Integer
For Each col As String In My.Settings.dgvColumnWidth.Split(";"c)
Me.DataGridView1.Columns(x).Width = col
x += 1
Next
End If
sql_param3.Value = FldCmfrnumTextBox.Text
dxt3 = New DataTable
dxa3.Fill(dxt3)
DataGridView3.DataSource = dxt3
Me.DataGridView1.Select()
End If
End Sub
Public Sub SaveForward()
mlngData1 = Me.FldCmfrnumTextBox.Text ' Customer Mfrnumber
mlngData2 = Me.FldCmfgnameComboBox.Text ' Customer Mfgname
mlngData3 = Me.FldCPnumberTextBox.Text ' Customer Partnumber
mlngData4 = Me.FldProgramTextBox.Text ' Program
mlngData5 = Me.FldUnitTextBox.Text ' Unit
mlngData6 = Me.FldLevelTextBox.Text ' Level
mlngData7 = Me.FldPositionTextBox.Text ' Position
mlngData8 = Me.FldCompartmentTextBox.Text ' Compartment
mlngData9 = Me.FldCdescriptionTextBox.Text ' Customer Description
mlngData10 = Me.FldProductNotationTextBox.Text ' Product Notation
mlngData11 = Me.FldAssociateComboBox.Text ' Site Collector
End Sub
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
'TblMainDataBindingSource.RemoveCurrent()
'TblMainDataBindingSource.EndEdit()
End Sub
Private Sub BindingNavigatorAddNewItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
SaveForward()
Test1()
End Sub
Private Sub Test1()
' place values in textbox
If Me.CheckBox1.Checked = True Then
Me.FldCmfrnumTextBox.Text = mlngData1 ' Customer Mfrnumber
End If
If Me.CheckBox2.Checked = True Then
Me.FldCmfgnameComboBox.Text = mlngData2 ' Customer Mfrname
End If
If Me.CheckBox3.Checked = True Then
Me.FldCPnumberTextBox.Text = mlngData3 ' Customer PartNumber
End If
If Me.CheckBox4.Checked = True Then ' Position
Me.FldProgramTextBox.Text = mlngData4
End If
If Me.CheckBox5.Checked = True Then ' Unit
Me.FldUnitTextBox.Text = mlngData5
End If
If Me.CheckBox6.Checked = True Then 'Level
Me.FldLevelTextBox.Text = mlngData6
End If
If Me.CheckBox7.Checked = True Then ' Position
' Me.FldPositionTextBox.Text = mlngData7
If Me.CheckBox9.Checked = True Then
Me.FldPositionTextBox.Text = mlngData7 ' Position
Dim arg As Char = FldPositionTextBox.Text
If Char.IsLetter(arg) Then
Dim value As Integer = AscW(arg)
Select Case value
Case 65 To 89, 97 To 121
FldPositionTextBox.Text = ChrW(value + 1).ToString
End Select
End If
If Char.IsNumber(arg) Then
Dim value As Integer = CInt(FldPositionTextBox.Text)
Select Case value
Case Is > 0 ' or Case 1 To 1000
value += 1
FldPositionTextBox.Text = value.ToString
If Me.FldPositionTextBox.Text = "1" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "2" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "3" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "4" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "5" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "6" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "7" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "8" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "9" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
End Select
End If
End If
Else
' else not checked
' Me.FldPositionTextBox.Clear()
End If
If Me.CheckBox8.Checked = True Then ' Compartment
' Me.FldCompartmentTextBox.Text = mlngData8
If Me.CheckBox10.Checked = True Then
Me.FldCompartmentTextBox.Text = mlngData8 ' Compartment
Dim arg As Char = FldCompartmentTextBox.Text
If Char.IsLetter(arg) Then
Dim value As Integer = AscW(arg)
Select Case value
Case 65 To 89, 97 To 121
FldCompartmentTextBox.Text = ChrW(value + 1).ToString
End Select
End If
If Char.IsNumber(arg) Then
Dim value As Integer = CInt(FldCompartmentTextBox.Text)
Select Case value
Case Is > 0 ' or Case 1 To 1000
value += 1
FldCompartmentTextBox.Text = value.ToString
If Me.FldCompartmentTextBox.Text = "1" Then FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "2" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "3" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "4" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "5" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "6" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "7" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "8" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "9" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
End Select
End If
End If
Else
' else not checked
' FldCompartmentTextBox.Clear()
End If
If Me.CheckBox11.Checked = True Then ' Description
Me.FldCdescriptionTextBox.Text = mlngData9
End If
If Me.CheckBox12.Checked = True Then ' Product Notation
Me.FldProductNotationTextBox.Text = mlngData10
End If
If Me.CheckBox13.Checked = True Then ' Collector
Me.FldAssociateComboBox.Text = mlngData11
End If
End Sub
Private Sub btnDataview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDataview.Click
If frmDataView.Visible = True Then
frmDataView.BringToFront()
Else
frmDataView.Show()
End If
End Sub
Private Sub FldGraingerTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FldGraingerTextBox.TextChanged
Try
sql_param2.Value = FldGraingerTextBox.Text
dxt2 = New DataTable
dxa2.Fill(dxt2)
DataGridView2.DataSource = dxt2
Catch
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If MessageBox.Show("Are you are sure you want to Post An Functional Match?", _
"Posting Functional Match.", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
' POSTING FOR XREF FUNCTIONAL
FldCmfrnumTextBox.Text = DataGridView1.CurrentRow.Cells(0).Value.ToString() ' Customer Part Number
'txtMfrname.Text = DataGridView1.CurrentRow.Cells(1).Value.ToString()
' cboMfgnames.Text = DataGridView1.CurrentRow.Cells(1).Value.ToString()
FldCdescriptionTextBox.Text = DataGridView1.CurrentRow.Cells(2).Value.ToString()
FldGraingerTextBox.Text = DataGridView1.CurrentRow.Cells(3).Value.ToString()
' MIGHT HAVE TO PUT ON CONDITION ON GRID "O"
FldXrefTypeTextBox.Text = "F"
FldSalesStatusTextBox.Text = DataGridView1.CurrentRow.Cells(5).Value.ToString()
FldAlt1TextBox.Text = DataGridView1.CurrentRow.Cells(9).Value.ToString()
End If
Me.FldCmfrnumTextBox.Select() ' mfrnumber select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If MessageBox.Show("Are you are sure you want to Post An Exact Match?", _
"Posting Functional Match.", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
' POSTING FOR XREF ON EXACT
FldCmfrnumTextBox.Text = DataGridView1.CurrentRow.Cells(8).Value.ToString() '
'txtMfrname.Text = DataGridView1.CurrentRow.Cells(7).Value.ToString() '
FldCmfgnameComboBox.Text = DataGridView1.CurrentRow.Cells(7).Value.ToString() '
FldCdescriptionTextBox.Text = DataGridView1.CurrentRow.Cells(2).Value.ToString() '
FldGraingerTextBox.Text = DataGridView1.CurrentRow.Cells(3).Value.ToString() '
' MIGHT HAVE TO PUT ON CONDITION ON GRID "O"
FldXrefTypeTextBox.Text = "E" '
FldSalesStatusTextBox.Text = DataGridView1.CurrentRow.Cells(5).Value.ToString() '
FldAlt1TextBox.Text = DataGridView1.CurrentRow.Cells(9).Value.ToString() '
End If
Me.FldCmfrnumTextBox.Select() ' mfrnumber select
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If MessageBox.Show("Are you are sure you want to Post An Functional Match?", _
"Posting Functional Match.", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
' POSTING FOR GRAINGER SKU ON FUNCTIONAL
FldCdescriptionTextBox.Text = DataGridView2.CurrentRow.Cells(3).Value.ToString()
FldGraingerTextBox.Text = DataGridView2.CurrentRow.Cells(0).Value.ToString()
' MIGHT HAVE TO PUT ON CONDITION ON GRID "O"
FldXrefTypeTextBox.Text = "F"
FldSalesStatusTextBox.Text = DataGridView2.CurrentRow.Cells(2).Value.ToString()
FldAlt1TextBox.Text = DataGridView2.CurrentRow.Cells(5).Value.ToString()
End If
Me.FldCmfrnumTextBox.Select() ' mfrnumber select
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If MessageBox.Show("Are you are sure you want to Post An Exact Match?", _
"Posting Functional Match.", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
' POSTING FOR EXACT ON GRAINGER SKU
FldCmfrnumTextBox.Text = DataGridView2.CurrentRow.Cells(14).Value.ToString() '
'txtMfrname.Text = DataGridView2.CurrentRow.Cells(12).Value.ToString()
FldCmfgnameComboBox.Text = DataGridView2.CurrentRow.Cells(13).Value.ToString()
FldCdescriptionTextBox.Text = DataGridView2.CurrentRow.Cells(3).Value.ToString()
FldGraingerTextBox.Text = DataGridView2.CurrentRow.Cells(0).Value.ToString()
' MIGHT HAVE TO PUT ON CONDITION ON GRID "O"
FldXrefTypeTextBox.Text = "E"
FldSalesStatusTextBox.Text = DataGridView2.CurrentRow.Cells(2).Value.ToString()
FldAlt1TextBox.Text = DataGridView2.CurrentRow.Cells(5).Value.ToString()
End If
Me.FldCmfrnumTextBox.Select() ' mfrnumber select
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If MessageBox.Show("Are you are sure you want to Post An Functional Match?", _
"Posting Functional Match.", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
' POSTING FOR GPARTS FINDMRO
FldCmfrnumTextBox.Text = DataGridView3.CurrentRow.Cells(0).Value.ToString() '
' txtMfrname.Text = DataGridView1.CurrentRow.Cells(1).Value.ToString() '
FldCmfgnameComboBox.Text = DataGridView3.CurrentRow.Cells(1).Value.ToString() '
FldCdescriptionTextBox.Text = DataGridView3.CurrentRow.Cells(2).Value.ToString() '
FldGraingerTextBox.Text = DataGridView3.CurrentRow.Cells(3).Value.ToString() '
' MIGHT HAVE TO PUT ON CONDITION ON GRID "O"
FldXrefTypeTextBox.Text = "G"
FldSalesStatusTextBox.Text = "GPARTS"
FldAlt1TextBox.Text = ""
End If
Me.FldCmfrnumTextBox.Select() ' mfrnumber select
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
' save the column orders to the Application settings
If My.Settings.ColumnOrders Is Nothing Then
My.Settings.ColumnOrders = New System.Collections.Specialized.StringCollection()
End If
My.Settings.ColumnOrders.Clear()
For Each col As DataGridViewColumn In Me.DataGridView1.Columns
My.Settings.ColumnOrders.Add(col.DisplayIndex.ToString())
' My.Settings.ColumnOrders.Add(col.Width.ToString())
Next
My.Settings.Save()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If My.Settings.ColumnOrders IsNot Nothing Then
For j As Integer = 0 To My.Settings.ColumnOrders.Count - 1
Dim index As Integer = Convert.ToInt32(My.Settings.ColumnOrders(j))
Me.DataGridView1.Columns(j).DisplayIndex = index
Next
End If
End Sub
Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
Me.Close()
End Sub
Private Sub FldPositionTextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles FldPositionTextBox.LostFocus
If Me.FldPositionTextBox.Text = "1" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "2" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "3" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "4" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "5" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "6" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "7" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "8" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
If Me.FldPositionTextBox.Text = "9" Then Me.FldPositionTextBox.Text = "0" + Me.FldPositionTextBox.Text
' LostFocusSave()
End Sub
Private Sub FldCompartmentTextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles FldCompartmentTextBox.LostFocus
If Me.FldCompartmentTextBox.Text = "1" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "2" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "3" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "4" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "5" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "6" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "7" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "8" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
If Me.FldCompartmentTextBox.Text = "9" Then Me.FldCompartmentTextBox.Text = "0" + Me.FldCompartmentTextBox.Text
' LostFocusSave()
End Sub
End Class
What happens if you type the value into the textbox instead of programmtically? Does it persist?
ASKER
Codecruiser, Yes it does...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have seen this problem before where programmatic changes to bound controls are not persisted. It could be classed as a bug probably.
ASKER
The only thing I can figure the "current changed" event method of the binging sourcde must be firing after the bindings are complete..which is I think my problem from the get go...
I don't really know...mystery to me right now...
I don't really know...mystery to me right now...
ASKER
To All,
well 2 problems now...I don't know how to score this and I'll let ya know if any problems arise from what I have done thus far !
well 2 problems now...I don't know how to score this and I'll let ya know if any problems arise from what I have done thus far !
ASKER
I solved the questrion but all were good reading solutions
ASKER
Thanks
ASKER