?
Solved

vb.net DataGridView1_CellContentClick(sender, e)

Posted on 2008-10-07
3
Medium Priority
?
1,510 Views
Last Modified: 2012-05-05
All I want to do is call this method after I leave a textbox but I get an error saying:
"Value of type System.Windows.Forms.KeyEventArgs cannot be converted to System.Windows.Forms.DataGridViewCellEventArgs

I am trying to call the method by using this:   DataGridView1_CellContentClick(sender,e)

'to call this:

Public Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellContentClick

'do this

end sub

I dont know what to do, pls help.
0
Comment
Question by:logoncom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 22663953
If that is the right place to do that, then you need to create a new DataGridViewCellEventArgs instance, and pass that.
0
 
LVL 14

Accepted Solution

by:
rachitkohli earned 2000 total points
ID: 22666495
call like this :

Dim eNew as DataGridViewCellEventArgs
Call DataGridView1_CellContentClick(sender,eNew)
0
 

Author Comment

by:logoncom
ID: 22668979
Ok, that gets me over to the event, but then I get "Object reference not set to an instance of an object".  

I am sending over  'vjobnumber' which is usually got from dgv_cellclick.  
vjobnumber = dgv.Rows(e.RowIndex).Cells(0).Value

So what I am trying to do is reverse the process.  since I have vjobnumber, I want to click  dgv.Rows(e.RowIndex).Cells(0).Value because when I click a specific cell something happens.



 
    Private Sub dgv_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellClick
 
 
        If e.RowIndex > -1 Then
 
 
            Try
                Dim completevalue As Integer
 
 
                Select Case cbbfilter.Text
                    Case "Open Jobs"
                        completevalue = 1
                        vjobnumber = dgv.Rows(e.RowIndex).Cells(0).Value
 
                    Case "Completed Jobs"
                        completevalue = 2
                        vjobnumber = dgv.Rows(e.RowIndex).Cells(0).Value
 
                    Case "Billed Jobs"
                        completevalue = 3
                        vjobnumber = dgv.Rows(e.RowIndex).Cells(0).Value
 
                    Case "On Hold Jobs"
                        completevalue = 0
                        vjobnumber = dgv.Rows(e.RowIndex).Cells(0).Value
 
                    Case "Estimates"
                        completevalue = 5
                        JobsheetEstimateNumber = dgv.Rows(e.RowIndex).Cells(0).Value.ToString
                End Select
 
 
                doesjobnumberexist(vjobnumber)
 
 
                panelhidecontrols.Enabled = True
 
                Panel3.Enabled = True
 
                btnjobsheet.ForeColor = Color.Red
                btnjobsheet.Enabled = True
 
                btnpostage.Enabled = True
 
 
 
                If completevalue = 0 Then
 
                    btneditjob.Enabled = True
                    btneditjob.ForeColor = Color.Red
                    btnBillJob.Enabled = False
                ElseIf completevalue = 1 Then
 
                    btneditjob.Enabled = True
                    btneditjob.ForeColor = Color.Red
                    btnBillJob.Enabled = False
                    btnservices.Enabled = True
 
                ElseIf completevalue = 2 Then
 
                    btnBillJob.ForeColor = Color.Red
                    btnBillJob.Enabled = True
                    btneditjob.Enabled = False
 
                ElseIf completevalue = 3 Then
 
                    btnBillJob.ForeColor = Color.Red
                    btneditjob.Enabled = False
                    btnBillJob.Enabled = True
 
                ElseIf completevalue = 5 Then
 
                    btnestjs.Enabled = True
                    btnopenest.Enabled = True
                    btnopenest.ForeColor = Color.Red
                    btnservices.Enabled = True
                    btnjobsheet.ForeColor = Color.Black
                    btnjobsheet.Enabled = False
                    btnrecreate.Enabled = False
                    btneditjob.Enabled = False
 
 
                End If
 
                GetJobStatusforGroupBox(completevalue)
 
 
            Catch ex As Exception
 
                MessageBox.Show(ex.Message)
            End Try
        End If
    End Sub

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question