Welcome to Dream.In.Code
Become a VB Expert!

Join 149,384 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,355 people online right now. Registration is fast and FREE... Join Now!




TextBox Question

 
Reply to this topicStart new topic

TextBox Question, Locking value to variable

Squirrel
6 May, 2007 - 10:42 PM
Post #1

D.I.C Head
**

Joined: 6 Feb, 2007
Posts: 61


My Contributions
Hey guys, first time trying VB so I'll try to be descriptive... I have a textbox (TextBox1) that I want to refresh everytime I click a button. Here is the code for the textbox:

CODE
  Me.TextBox1.Enabled = False
        Me.TextBox1.Location = New System.Drawing.Point(48, 123)
        Me.TextBox1.Size = New System.Drawing.Size(229, 24)
        Me.TextBox1.Text = textValue


Where the TextBox1 text is bounded by the variable textValue (string).

Here is the code for the click of the button:

CODE
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
0:
        
        textValue = "I CHANGED!"
        
End Sub


I'm sure I'm missing a refresh or something, but I really dont know how to refresh a textbox. Any help?
User is offlineProfile CardPM
+Quote Post

tody4me
RE: TextBox Question
7 May, 2007 - 05:33 AM
Post #2

Only Jenny Craig makes thin clients...
Group Icon

Joined: 12 Apr, 2006
Posts: 1,349



Thanked: 5 times
Dream Kudos: 100
My Contributions
where is this code?
QUOTE

CODE

Me.TextBox1.Enabled = False
        Me.TextBox1.Location = New System.Drawing.Point(48, 123)
        Me.TextBox1.Size = New System.Drawing.Size(229, 24)
        Me.TextBox1.Text = textValue


You are going to want to add this code to a function somewhere in the program and call that function in the menuitem1_click event. Then call Application.DoEvents() after the function is executed. So something like this
CODE

private sub menuitem1_click(...)
  textvalue="I Changed"
  <SomeFunctionThat holds the above code>
  Application.DoEvents
end sub

User is offlineProfile CardPM
+Quote Post

Squirrel
RE: TextBox Question
7 May, 2007 - 06:19 AM
Post #3

D.I.C Head
**

Joined: 6 Feb, 2007
Posts: 61


My Contributions
OH nvm I found it earlier this morning. Its TextBox1.Text = variable inside the click handler and then, to refresh it (also in the handler) its TextBox1.refresh()

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:44AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month