Hi, I am getting the following error:
Expecting 2 value(s) for the key being indexed, but received 1 value(s)
in relation to this line of code:
objCurrentRow3 = objDataSet.Tabl es("tblAttendan ce").Rows.Find( lstStuIDs.Items (iLoop).ToStrin g)
"tblAttenda nce" has a composite primary key - a date field and an ID field.
lstStuIDs.Items (iLoop).ToStrin g contains the ID....
User Profile
Collapse
-
Printing the entire contents of a datagridview
Hi,
I need to be able to print the contents of a datagrid view. I have the printdialog, printdocument and printpreview dialog controls put on my form.. Here is my code so far:
...Code:Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click If Me.PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Me.PrintDocument1.Print() -
NullReferenceException - Getting the string contained in each item
Hi,
I keep getting the error " Object reference not set to an instance of an object." in relation to the line : selA = CType(lstStuden ts.Items(r.Inde x), String)
Any advice/help?
...Code:Dim BRow As DataRow Dim i As Integer Dim selA As String selA = CType(lstStudents.Items(r.Index), String) BRow = objDataSet.Tables("tblStudent").Rows.Find(selA) -
"TodaysAbsentee s" is the name of the query in my database and it is spelt correctly.
I made the changes to my code that you recommended but when I run it I still get that same error: "no value given for one or more required parameters".
I should mention, I have never used queries with vb before so don't really know what I'm doing. I've just been googling stuf to try and piece it together. But from... -
I've been working on it since posting this question earlier.
New Code::
...Code:Imports System Imports System.Data Imports System.Data.OleDb Imports System.Data.SqlClient Public Class frmTodaysAbsentees Inherits System.Windows.Forms.Form Dim objDataSet As New DataSet Dim objConnection As New OleDb.OleDbConnection( _ "Provider=Microsoft.Jet.OLEDB.4.0;DataLeave a comment:
-
Object reference not set to an instance of an object.
I need help with an error I'm getting;
"Object reference not set to an instance of an object." The error occurs at the line :The items in lstStudents is text. StudentID is an autonumber.Code:Dim intselA As Integer = CInt(lstStudents.SelectedItem.ToString)
What I'm trying to do is populate a the database with all the studentID's of the names in the list box. (i.e. every name in the list box has a corresponding... -
Querying and VB
Hi,
I have a MS Access DB with a query that I need to display in vb but am not too sure on how to go about it. The query has some criteria - i.e you have to input a date to run the query. I think that's a parameter in vb......
Well I've been playing around with it for some time now but amn't really getting anywhere. Could ye recommend any good tutorial or link as to how to do it?
Here's the code that I've been... -
-
Clear all checkboxes at form load
Hi,
I have a pile of checkboxes on one particular form and would like to clear them all at the form load rather that saying chk1.Checked = False for all of them.
Here is the code I was trying to use but 'checked' is not a member of Systems.Windows .Forms.Controls .
[Code=VBNET]
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is CheckBox Then
...
No activity results to display
Show More
Leave a comment: