|
-
Jun 1st, 2000, 06:55 AM
#1
Thread Starter
Hyperactive Member
Hi there,
I put a grumpy face as my icon because I've been at this for 3 hours.
I've got some code that was written for a picturebox, but I need to change it to a textbox. Mostly this involves changing Picturebox1.Print to Text1.Tex, but I'm having difficulty with the positioning. For example, with Picturebox1.Print in the place of Text1.Text below, the code works as it should, but with Text1.Text only the last line, 'Work out the answer on your notepad' is displayed.
It should read like:
---------
Upper Expression: (1)(6x-4=20)
Lower Expression: (2)(3x+5=17)
Work out the answer on your notepad.
----------
What must I do with my code to display all this in textbox?
Thanks for any help!
With Text1 'positioning
.FontSize = 22
End With
Text1.Text = "Upper expression:"
Text1.FontSize = 22
If mul Then
If tmp1 Then
Text1.Text = "(" & Trim$(mul) & ")"
Else
Text1.Text = "(1)"
End If
Else
If xory = "x" Then
Text1.Text = "(" & Trim$(c) & ")"
Else
Text1.Text = "(" & Trim$(d) & ")"
End If
End If
Text1.Text = "(" & Trim$(a) & "x"
If b > -1 Then Text1.Text = "+"
Text1.Text = Trim$(b) & "=" & Trim$(a * x + b * y) & ")"
Text1.Text = "Lower expression:"
If mul Then
If tmp1 Then
Text1.Text = "(1)"
Else
Text1.Text = "(" & Trim$(mul) & ")"
End If
Else
If xory = "x" Then
Text1.Text = "(" & Trim$(a) & ")"
Else
Text1.Text = "(" & Trim$(b) & ")"
End If
End If
Text1.Text = "(" & Trim$(c) & "x"
If d > -1 Then Text1.Text = "+"
Text1.Text = Trim$(d) & "=" & Trim$(c * x + d * y) & ")"
Text1 = "Work out the answer on your notepad."
-
Jun 1st, 2000, 03:14 PM
#2
Frenzied Member
Your code is near incomprehensible 
But I can see straight away that
Text1 = "Work out the answer on your notepad."
Ought to be
Text1 = Text1 & "Work out the answer on your notepad."
otherwise you are just overwriting whatever is already in text1.text
-
Jun 1st, 2000, 03:32 PM
#3
Lively Member
The TAB key makes a world of difference you know! If I were you, i would indent a lot of that to make it read easier, and also use variable names that mean something
Mag-Net's Home
Visual Studio 6-Enterprise - SP4
ICQ: 35519773
Have Fun 
-
Jun 1st, 2000, 04:32 PM
#4
Addicted Member
...and since all your code is relating to 'Text1', why didn't you put your 'End With' at the end of this code?
Yeah the code might be untidy, but if it works and the programmer understands it, who cares??!
-
Jun 1st, 2000, 04:33 PM
#5
Addicted Member
Er... one more thing! Don't forget to set Text1's MultiLine property to TRUE, otherwise Mark Sreeves' code will make little difference.
-
Jun 1st, 2000, 05:16 PM
#6
Lively Member
Thanks for the help. Actually the code makes perfect sense in the context of all the other code. I'll have a go at the Text1=Text1 & "".
-
Jun 1st, 2000, 09:09 PM
#7
Or you can use the Chr$(9) function which is like pressing the tab key .
Code:
Text1.text = "Hello." & Chr$(9) & "Welcome to Vb-world.net!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|