473,320 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to declare form textbox in vb module

I have a module with an array, so I want the results of an array to be displayed in a form textbox.

When I'm trying to use the texbox in a module a get an error that reads "Error'textbox' is not declared. It may be inaccessible due to its protection level.", so how do I solve this problem?
Feb 7 '13 #1
4 4677
Rabbit
12,516 Expert Mod 8TB
We would need to see the code.
Feb 7 '13 #2
here are my codes

Expand|Select|Wrap|Line Numbers
  1. Module Module1
  2.     Sub AddCourse(ByVal Team As String, ByRef ReturnString As String)
  3.         Dim Subjects() = {"Ms Office 2007", "internet and commmunications", "Lifetime skills"}
  4.  
  5.         Dim CourseName As String = ""
  6.         Dim Result As String
  7.         Dim i As Short
  8.         Dim Title As String
  9.  
  10.  
  11.  
  12.  
  13.         Dim Prompt, Mn, WrapCharacter As String
  14.         Prompt = "Enter registred Course." & Team
  15.         Mn = InputBox(Prompt, "input box")
  16.         WrapCharacter = Chr(13) + Chr(10)
  17.         ReturnString = Mn & WrapCharacter
  18.  
  19.  
  20.         If Mn = "computer literacy" Then
  21.             Result = "Student is registered for Course name " & CourseName & vbCrLf & vbCrLf
  22.             For i = 0 To UBound(Subjects) ' FOR LOOP TO WRITE AN ARRAY
  23.                 Title = "Subject = " & (i + 1)
  24.  
  25.                 Result = Result & "Subject = " & (i + 1) & vbTab & _
  26.                             Subjects(i) & vbCrLf
  27.  
  28.  
  29.             Next
  30.  
  31.         Else
  32.             MsgBox("Enter computer literacy")
  33.  
  34.         End If
  35.     End Sub
Feb 7 '13 #3
Rabbit
12,516 Expert Mod 8TB
And which line causes the error?
Feb 7 '13 #4
IronRazer
83 64KB
Hey tshukela,
I do not see any call to send anything to a textbox but, if i am understanding correct you want to send the (Result) string to a textbox on your form from within the module. If so you could try this :

1. Replace (Form1) with the name of your form that has the textbox on it.
2. Replace (Textbox1) with the name of your textbox.
3. Make sure your textbox (Multiline) property is set to True.

Expand|Select|Wrap|Line Numbers
  1.         For i = 0 To UBound(subjects) ' FOR LOOP TO WRITE AN ARRAY
  2.             result = result & "Subject = " & (i + 1) & vbTab & subjects(i) & vbCrLf
  3.         Next
  4.         Form1.TextBox1.Text = result
  5.  
Feb 9 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Hareth | last post by:
i got the idea "form.textbox.text = label.text" from vb... i tried it in C# but it generated errors i found a diff example from :...
1
by: joye | last post by:
Hi, I know how the show a MessageBox in Form.h module by using VC.NET. But I don't know how to show the MessageBox at another class such as task.cpp which called by the Form.h; my question is...
16
by: Adda | last post by:
If I cycle through the MdiChildActivate event of the parent form I can read text in a textbox on the child mdiform -- console.writeline(Me.ActiveMdiChild.Controls(1).Text) But if I have a sub...
2
by: danparks | last post by:
I understand how to use ASP to retrieve a value from a form textbox. I don't understand how to use ASP to fill in a value in a form textbox. I'm guessing that perhaps Response.Write can be used? If...
1
by: almurph | last post by:
Hi everyone, Is it possible to make a new events for a Web-form textbox. What I mean to ask is that I want an event to fire everytime a user enters a letter into a Web-form textbox. The only...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
1
kirubagari
by: kirubagari | last post by:
Dear expert, i had written the code in my form Public Function HoldType(ByRef sType As String) As String If bOkClicked Then sType = "Rehold " End If
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.