Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6589673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:12:17+00:00 2026-05-25T17:12:17+00:00

Doing some homework on unit testing and in all honestly i just don’t get

  • 0

Doing some homework on unit testing and in all honestly i just don’t get why i get this error.

i got a simple method that select all text when tab and testing if the actually textbox1 is selected. I just don’t get why i’m getting a nullReferenceException at target.txtbox1_Enter(sender, e)

I’m getting really mad because this seem so easy.

any help i would appreciate it.

Private Sub txtbox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtbox1.enter
    Dim txtBox As TextBox
    txtBox = CType(sender, TextBox)
    txtBox.SelectAll()
End Sub

    <TestMethod(), DeploymentItem("frmtesting.exe")>
Public Sub txtCustomer_EnterTest()
    Dim target As frmtesting_Accessor = New frmtesting_Accessor ' TODO: Initialize to an appropriate value
    Dim sender As Object = Nothing ' TODO: Initialize to an appropriate value
    Dim e As EventArgs = Nothing ' TODO: Initialize to an appropriate value

    Dim expected As String
    Dim actual As String
    target.txtbox1.Text = "bob"
    target.txtbox1.SelectAll()
    expected = "bob"

    target.txtbox1_Enter(sender, e)

    actual = target.txtbox1.SelectedText
    Assert.AreEqual(expected, actual, "not equal")
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:12:17+00:00Added an answer on May 25, 2026 at 5:12 pm

    This would be the correct way of doing it.

    '''<summary>
        '''A test for TextBox1_Enter
        '''</summary>
        <TestMethod(), _
         DeploymentItem("frmtesting.exe")> _
        Public Sub TextBox1_EnterTest()
            Dim target As frmtesting.exe_Accessor = New frmtesting.exe_Accessor()
            Dim sender As Object = target.TextBox1
            Dim e As EventArgs = Nothing
    
            target.txtBox1.Text = "bob"
    
            target.txtBox1_Enter(sender, e)
    
            Assert.AreEqual("bob", target.txtBox1.SelectedText, "not equal")
    
        End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a homework problem that I have. I have been doing some research
Doing some exercises with simple file encryption/decryption and am currently just reading in a
I'm doing some homework, and having a hard time understanding closures. This is in
I am doing some assembly homework and thought the best way to get my
I'm doing some homework in Lisp, using clisp to test, and I'm loading this
So I've been doing this all night - can't quite understand my homework, and
while doing some homework in my very strange C++ book, which I've been told
I'm doing some homework and while I have some experience with SML, Haskell has
I was working on my advanced calculus homework today and we're doing some iteration
This is NOT a homework question, actually I am doing this for fun. Here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.