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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:46:08+00:00 2026-05-13T01:46:08+00:00

In an attempt to clean up my code, I have tried to put all

  • 0

In an attempt to clean up my code, I have tried to put all my functions and subroutines in a module. One of these subroutines populated a grid of RichTextBoxes with data from a MS Access database. It worked when the subroutine was in the form that it was being used on, but not in my Module. Is there any specific reason for this? I noticed while trying to use a RichTextBox in the code it said I needed to define it, so I went ahead and added this to the top of my Module:

Dim mon1 As New RichTextBox
Dim mon2 As New RichTextBox
Dim mon3 As New RichTextBox
Dim mon4 As New RichTextBox
Dim mon5 As New RichTextBox

It didn’t actually put any text into the RichTextBoxes on my form and the subroutine did not throw back an error. I tried changing it from Dim to Public and it does the same thing.

Can anyone shed some light on this? Thanks.

  • 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-13T01:46:08+00:00Added an answer on May 13, 2026 at 1:46 am

    You simply need to reference it, in your module, as Form1.RichTextBox1 (obviously replace those placeholders with the actual name properties of your form and richtextbox controls).

    This is assuming you are referring to VB.NET.

    Declaring a new RichTextBox control in your module is not going help you reference those you have already placed on your form with the Visual Studio editor or declared in the code of your form.

    Is there any specific reason for this?

    The reason the subroutine doesn’t work in your module is simply that the RichTextBox variables are not visible in that scope.

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

Sidebar

Related Questions

Has there been any attempt and creating a formalized method for organizing CSS code?
I am using the following code to attempt to read a large file (280Mb)
I have the following code, which is run every 10ms as part of a
If I attempt to connect to Mac OS X 10.5 Leopard's built in vnc
In an attempt to add some parameter validation and correct usage semantics to our
When you attempt to declare an unsigned variable in C#.NET with a value outside
I've decided to attempt using the double submitted cookies technique to attempt to prevent
This is an attempt to rephrase a question I asked earlier. I'd like to
When I attempt to use the iterator form of parsing for a Spirit grammar
For some reason when I attempt to make a request to an Ajax.net web

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.