-
July 30th, 2008, 03:18 AM
#16
Re: DataGridViewComboBox problem!
Did anyone manage to take a look? I agree that the code is fine - tried it in another databound Datagrid of mine and it worked fine.
There's gotta be something preventing it either in the designer or in code!
Visual Basic 2005 ver. 8.0.50727.867
-
July 30th, 2008, 03:24 AM
#17
Re: DataGridViewComboBox problem!
I have sorted it. All I did was change the Property Readonly from True to False in the Datagridview designer and now it works!
Surely that shouldn't have been affecting the ComboBoxColumn??
Visual Basic 2005 ver. 8.0.50727.867
-
July 30th, 2008, 03:47 AM
#18
Re: DataGridViewComboBox problem!
That kind of makes sense - if the entire grid is read-only, then you won't be allowed to change the value of the combo, so it won't drop down.
Help from me is always guaranteed!*
VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.
*Guarantee may not be honoured.
-
July 30th, 2008, 03:52 AM
#19
Re: DataGridViewComboBox problem!
It's doing something else strange now - when I click save it says that:
Parameter @7 has no default value
This is the column I was having trouble with before. I have tried both selecting values for each row in the column and also setting:
Code:
.DefaultCellStyle.NullValue = "0"
but it still comes up with that error. I have also tried:
Code:
DataGridView1.CommitEdit
but still nothing!
Visual Basic 2005 ver. 8.0.50727.867
-
July 30th, 2008, 05:09 AM
#20
Re: DataGridViewComboBox problem!
LOL! It is always the small things that mean big headaches!
I knew it had to be something else
I just run your app now ( only started with it now ), and I got a Parameter @13 has no default value, in this section :
Code:
If ExcelYear = "10" Then
Dim MyExcelConnection As New System.Data.OleDb.OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\08-09\Year 10 2008-09.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=0""")
MyExcelConnection.Open()
With myInsertCommand
.CommandText = "Insert INTO [Sheet1$] ([StudentId],[StudentName],[ClassGrp],[TheDate],[Merits],[Demerits],[Penalty],[Lesson]," + _
"[TeachingGrp],[Staff],[Description],[Action],[MeritType]) VALUES(@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12,@13)"
.CommandType = CommandType.Text
.Connection = MyExcelConnection
For Each Row As DataGridViewRow In DataGridView1.Rows
For Col As Int32 = 1 To Row.Cells.Count
.Parameters.Add(New OleDb.OleDbParameter("@" & Col, OleDb.OleDbType.Char)).Value = CStr(Row.Cells(Col - 1).Value)
Next Col
.ExecuteNonQuery()
.Parameters.Clear()
Next
End With
Parameter 13 in this case is Merits
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|