none
how to check a radio button from datagridview datagridview.MouseClick ? Continued RRS feed

  • Question

  • Hi,

    thank you for you help.

    I am testing your code but i get an exception 

    "the NullExceptionReference was not handling"

    at this part of code.

     If currentValue = "M" Then  pForm.RadioButton1.Checked = True  ElseIf currentValue = "F" Then pForm.RadioButton2.Checked = True Else  pForm.RadioButton1.Checked = False  pForm.RadioButton2.Checked = False  End If

    Best regards , Bajtitou.


    Saturday, March 10, 2018 5:52 PM

All replies

  • Hi,

    thank you for you help.

    I am testing your code but i get an exception 

    "the NullExceptionReference was not handling"

    at this part of code.

     If currentValue = "M" Then  pForm.RadioButton1.Checked = True  ElseIf currentValue = "F" Then pForm.RadioButton2.Checked = True Else  pForm.RadioButton1.Checked = False  pForm.RadioButton2.Checked = False  End If

    Best regards , Bajtitou.


    Hello,

    I tried my best to invoke an exception but could not. Could you download, build and run the following project which consist of the code I shared earlier and see if you can reproduce the error. If so which line throw the error.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, March 10, 2018 7:00 PM
    Moderator
  • Hi ,

    I downloaded the project and i build it ,

    the child form appear but not the main form.

    thers is no error , it send me "the NullExceptionReference was not handling".

    Please can you show me how can i submit a screen capture?

    Lot of thanks and Best regard for you.

    Bajtitou.


    • Edited by Bajtitou Saturday, March 10, 2018 8:31 PM
    Saturday, March 10, 2018 8:00 PM
  • Hi ,

    I downloaded the project and i build it ,

    the child form appear but not the main form.

    thers is any error , it send me "the NullExceptionReference was not handling".

    Please can show how can i submit a screen capture?

    Lot of thanks and Best regard for you.

    Bajtitou.

    Questions

    • What version of Windows are you working under. I'm using Windows 7
    • What version of Visual Studio are you using e.g. VS2017 (which is what I created this in)
    • What line of code throw the exception?

    For the record, the code presented was first written in VS2008 many years ago, never failed to work.

    Note a good way to capture the exception is using a try/catch in tangent with stepping through the code with the debugger.

    Private Sub DoFormWork()
        Try
            If Not My.Application.IsFormOpen(_childFormName) Then
                _mChildForm = New ChildForm
                _mChildForm.Owner = Me
                _mFirstTime = True
            End If
            _mChildForm.Show()
            If _mFirstTime Then
                _mChildForm.Location = New Point(Me.Left + Me.Width, Top)
                _mFirstTime = False
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    How to create a screen capture, select a screen capture tool such as windows snipping tool. Save the screen capture, press the image button in the thread editor, last button on the right and submit the image. I don't see how a screen capture is going to help but feel free to do one :-)


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, March 10, 2018 8:17 PM
    Moderator

  • Questions

    • What version of Windows are you working under. I'm using Windows 7
    • What version of Visual Studio are you using e.g. VS2017 (which is what I created this in)
    • What line of code throw the exception?


    Hi,

    • I am working Under Windows 8.
    • Visual Studio 2015.
    • The exception Is throw the Child Form line 23 If i click "M" in datagid,
    • Line 25 If I click "F",
    • And line 27 If Iclick "E".

    Thanks.



    • Edited by Bajtitou Saturday, March 10, 2018 10:06 PM
    Saturday, March 10, 2018 10:05 PM
  • Well here is what the lines you reported are on my machine which should be the same on your machine. With that even if the lines lined up to be frank about this there is zero sense for this to happen. I have nothing to offer to resolve this as I can not reproduce the error on my side.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, March 10, 2018 11:24 PM
    Moderator
  • Hi,

    Good morning.

    the same code except that i haven't the line 31 to 35.

    I add this lines and no thing changed.

     I have added "MyNamespaceAddition.vb code" in  a Code file 'CodeFile1.vb' , is it well or not?

    So, thank you for all .

    Best regards ,Bajtitou.


    • Edited by Bajtitou Sunday, March 11, 2018 7:03 AM
    Sunday, March 11, 2018 7:00 AM
  • Since I can not reproduce what is going on with your environment there is nothing else I can do other than provide one last code example. If that fails to work perhaps you can upload your project to Microsoft OneDrive, everyone with a Microsoft account has access to this.

    In the mean time I will be unavailable as I'm on a drive with a sport car club today.

    https://1drv.ms/u/s!AtGAgKKpqdWjiX-IkKgV96w2SAH3


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Sunday, March 11, 2018 12:31 PM
    Moderator
  • Hi,

    Good morning.

    the same code except that i haven't the line 31 to 35.

    I add this lines and no thing changed.

     I have added "MyNamespaceAddition.vb code" in  a Code file 'CodeFile1.vb' , is it well or not?

    So, thank you for all .

    Best regards ,Bajtitou.


    Without the code used as I provided could very easily cause issues. Not sure what you mean by 'CodeFile1.vb', the name was a good one from the start, meaningful while CodeFile1.vb tell you nothing to what is inside. MyNamespaceAddition means an addition to My Namespace.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Sunday, March 11, 2018 12:33 PM
    Moderator
  • Hi,

    thank you for you help.

    I am testing your code but i get an exception 

    "the NullExceptionReference was not handling"

    at this part of code.

     If currentValue = "M" Then  pForm.RadioButton1.Checked = True  ElseIf currentValue = "F" Then pForm.RadioButton2.Checked = True Else  pForm.RadioButton1.Checked = False  pForm.RadioButton2.Checked = False  End If

    Best regards , Bajtitou.


     Please be specific,  which line in that code is highlighted when the exception is thrown.

     When the exception is thrown,  hover your mouse over pForm and see if it says it is Nothing.

     It is doubtful it would be the currentValue as it looks like it must be a String but,  hover the mouse over currentValue and see if it is Nothing.

     My guess would be that pForm has not been created yet or has been closed/disposed before these lines of code are executed.


    If you say it can`t be done then i`ll try it

    • Edited by IronRazerz Sunday, March 11, 2018 1:59 PM
    Sunday, March 11, 2018 1:58 PM