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 8197725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:48:00+00:00 2026-06-07T05:48:00+00:00

Question: Why is it that holdDate under function Check(), show Nothing while debugging, I

  • 0

Question: Why is it that holdDate under function Check(), show “Nothing” while debugging, I was passing by reference. What am i missing guys??

Description of problem:

I have a class named Wallet, I created instance of that class in my main code by passing three parameters (Objects already on my form that will be populated with data from the user at a later time, not right away):

Dim myWallet As New Wallet(DataGridView1, DateTimePicker1, "StatementsLog.dat")

At run time I get this:
enter image description here

As you can see, the object that was suppose to reference the original object from the form is empty? I thought that if i passed by reference (as shown below) that the object will always show the data, and that would allow me to read it as shown in the screenshot above:

Public Sub New(ByRef Data As DataGridView, ByRef _Date As DateTimePicker, Optional ByVal StatementsFileName As String = "defaultLog.txt")
  'This constructor takes in references to use in class as private
  holdPath = StatementsFileName
  holdData = Data
  holdDate = _Date
End Sub

Here’s what i got so far for Class Wallet:

Option Strict On
Imports System
Imports System.IO

Public Class Wallet

  Private lcheckNumber As Integer = Nothing
  Private lcheckAmount As Decimal = Nothing
  Private ldepositAmount As Decimal = Nothing
  Private lfee As Decimal = Nothing
  Private lDescription As String = Nothing

  Private holdDate As New DateTimePicker
  Private holdData As New DataGridView
  Private holdPath As String = vbNullString

  'Default Constructor
  Public Sub New()
    holdPath = "defaultLog.txt"
  End Sub

  Public Sub New(ByRef _Data As DataGridView, ByRef _Date As DateTimePicker, Optional ByVal StatementsFileName As String = "defaultLog.txt")
    'This constructor takes in references to use in class as private
    holdPath = StatementsFileName
    holdData = _Data
    holdDate = _Date
  End Sub

  'Function Check - Deduct the amount from account and returns current balance.
  Public Function Check(ByVal CheckNumber As Integer, ByVal CheckAmount As Decimal, ByVal Description As String) As Decimal
    Try
      lcheckNumber = CheckNumber
      lcheckAmount = CheckAmount
      lDescription = Description
      lfee = 0D

      Dim _file As New FileStream(holdPath, FileMode.Append, FileAccess.Write)
      Using file As New StreamWriter(_file)
         file.WriteLine(holdDate.Value.ToString & "," & lDescription.ToString & "," & lcheckNumber.ToString & "," & lfee.ToString & "," & lcheckAmount.ToString)
      End Using
    Catch e As IOException
      MessageBox.Show(e.ToString)
    End Try

    Return 0D
  End Function

Form1 Code

Option Strict On
Imports WalletProgram.Wallet

Public Class Form1
    Dim myWallet As New Wallet(DataGridView1, DateTimePicker1, "StatementsLog.dat")


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        optCheck.Checked = True

        'Just test data for DataGridView1
        DataGridView1.Rows.Add(New String() {"12/21/1986", "Test", "44554", "44.22", "45.12"})
    End Sub

    Private Sub cmdAddTransaction_Click(sender As System.Object, e As System.EventArgs) Handles cmdAddTransaction.Click
        If optCheck.Checked Then
            lblAvailableFunds.Text = FormatCurrency(myWallet.Check(CInt(Trim(txtCheck.Text)), CDec(Trim(txtMoney.Text)), txtDescription.Text))
        End If
    End Sub
End Class
  • 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-06-07T05:48:01+00:00Added an answer on June 7, 2026 at 5:48 am

    The problem is most likely here:

    Public Class Form1
      Dim myWallet As New Wallet(DataGridView1, DateTimePicker1, "StatementsLog.dat")
    

    That will compile, but those objects haven’t been created yet since it happens before the form’s InitializeComponent routine gets called.

    Try changing the declaration to this:

    Public Class Form1
      Dim myWallet As Wallet
    
      Protected Overrides Sub OnLoad(e As System.EventArgs)
        _Wallet = New Wallet(DataGridView1, DateTimePicker1)
        MyBase.OnLoad(e)
      End Sub
    
    End Class
    

    where the Wallet class gets created after the controls have been created.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question that should be quick and easy for you guys to
A question that's lurking in my head for a while now. What's the importance
Simple question that is a flaw in my understanding of JQuery. $('input').focus(function() { $('.popup').click(function()
A question that has pondered me for the last while. I am primarily a
This is a question that came to mind while reading the brilliant answer by
A question that seems to have quite a few options for Python, but none
This isn't a question that I am expecting a specific answer to since it
I have a quick question that I can't seem to find online. I am
I have a SQL question that i need to ask the experts. To be
Here is a question that I encountered during an Interviewstreet codesprint . I was

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.