D
dbuchanan
Hello,
Is this a bug?
Is there some kind of work around?
I want to add default values for a few columns in my datagridview
I found the "DefaultValuesNeeded" event for the datagridview
I gave it a try using the example given in
http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview.defaultvaluesneeded.aspx
Here is my code
\\
Private Sub dgvDeviceTypes_DefaultValuesNeeded(ByVal sender As
Object, ByVal e As System.Windows.Forms.DataGridViewRowEventArgs)
Handles dgvDeviceTypes.DefaultValuesNeeded
'enter default values into lkpDeviceTypes
With e.Row
.Cells("dtHide").Value = False
.Cells("dtOrd").Value = 0
.Cells("bMachType").Value = True
End With
End Sub
//
I get the following error;
-----------------------
Column named rEditedBy cannot be found.
Parameter name: columnName
-----------------------
Here is my table;
pkDeviceTypeId smallint
DeviceName varchar(20)
Prefix char(4)
bMachType bit
dtOrd tinyint
dtHide bit
Below is the text of the error - Notice that the code cannot find the
column name. It seems that it thinks the column name is "columnName";
System.ArgumentException was unhandled
Message="Column named rEditedBy cannot be found.
Parameter name: columnName"
ParamName="columnName"
Source="System.Windows.Forms"
StackTrace:
at
System.Windows.Forms.DataGridViewCellCollection.get_Item(String
columnName)
at
QmsUI.f080AdminSetup.dgvLaborCostCodes_DefaultValuesNeeded(Object
sender, DataGridViewRowEventArgs e) in D:\DBuchanan MyDocuments\Visual
Studio 2005\Projects\Qms_01\QmsUI\Form1.vb:line 287
at
System.Windows.Forms.DataGridView.OnDefaultValuesNeeded(DataGridViewRowEventArgs
e)
at
System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell&
dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean
canCreateNewRow, Boolean validationFailureOccurred)
at
System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32
columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean
validateCurrentCell, Boolean throughMouseClick)
at System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo
hti, Boolean isShiftDown, Boolean isControlDown)
at
System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs
e)
at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs
e)
at System.Windows.Forms.Control.WmMouseDown(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.DataGridView.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext
context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[]
commandLine)
at QmsUI.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Is this a bug?
Is there some kind of work around?
thank you,
dbuchanan
Is this a bug?
Is there some kind of work around?
I want to add default values for a few columns in my datagridview
I found the "DefaultValuesNeeded" event for the datagridview
I gave it a try using the example given in
http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview.defaultvaluesneeded.aspx
Here is my code
\\
Private Sub dgvDeviceTypes_DefaultValuesNeeded(ByVal sender As
Object, ByVal e As System.Windows.Forms.DataGridViewRowEventArgs)
Handles dgvDeviceTypes.DefaultValuesNeeded
'enter default values into lkpDeviceTypes
With e.Row
.Cells("dtHide").Value = False
.Cells("dtOrd").Value = 0
.Cells("bMachType").Value = True
End With
End Sub
//
I get the following error;
-----------------------
Column named rEditedBy cannot be found.
Parameter name: columnName
-----------------------
Here is my table;
pkDeviceTypeId smallint
DeviceName varchar(20)
Prefix char(4)
bMachType bit
dtOrd tinyint
dtHide bit
Below is the text of the error - Notice that the code cannot find the
column name. It seems that it thinks the column name is "columnName";
System.ArgumentException was unhandled
Message="Column named rEditedBy cannot be found.
Parameter name: columnName"
ParamName="columnName"
Source="System.Windows.Forms"
StackTrace:
at
System.Windows.Forms.DataGridViewCellCollection.get_Item(String
columnName)
at
QmsUI.f080AdminSetup.dgvLaborCostCodes_DefaultValuesNeeded(Object
sender, DataGridViewRowEventArgs e) in D:\DBuchanan MyDocuments\Visual
Studio 2005\Projects\Qms_01\QmsUI\Form1.vb:line 287
at
System.Windows.Forms.DataGridView.OnDefaultValuesNeeded(DataGridViewRowEventArgs
e)
at
System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell&
dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean
canCreateNewRow, Boolean validationFailureOccurred)
at
System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32
columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean
validateCurrentCell, Boolean throughMouseClick)
at System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo
hti, Boolean isShiftDown, Boolean isControlDown)
at
System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs
e)
at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs
e)
at System.Windows.Forms.Control.WmMouseDown(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.DataGridView.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext
context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[]
commandLine)
at QmsUI.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Is this a bug?
Is there some kind of work around?
thank you,
dbuchanan