0

Hi all I need a bit of help I don’t know what I am looking for, basically I want a rich text box to display public variables like (pizza toppings dinks ect that have been selected in other forms) these variables have declare in a module. But I want the rich text box to display these variables as soon as the screen loads ( a on form load event) if you know what I mean.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by codeorder
1

When you mean public variables they are global variables correct? You can make a Public Property to send over your variable over to the other form.

Public Propery pizza_toppings()
get
return pizzatoppings
end get

Set(ByVal value)
            pizzatoppings = value
        End Set

So you can set the value from other form by pizza_topping()='place here value of what user selected

Then on the other form that you want to display, you can do this richtextbox1=pizza_topping()

0

Also, see if this helps.

Public Class Form1
    Public topping1, topping2, drink As String '// Global declared Strings.
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// set values to your Strings.
        '//-- if needed to set from other Forms, use: Form1.topping1="topping here", etc.
        topping1 = "Cheese"
        topping2 = "Steak"
        drink = "Water"
        '// set the preset values in RichTextBox on Form1_Load, when Form Loads.
        RichTextBox1.Text = topping1 & vbNewLine & topping2 & vbNewLine & drink
    End Sub
End Class

Edited by codeorder: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.