Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multilines in a textbox control - vb6

Status
Not open for further replies.

retiretopok

Programmer
Jul 10, 2013
2
0
0
US
Simulating many, many blackjack hands. Want to find out statistically what works and what doesn't.
Attempting to display results in multiline textbox. Is inside a while/wend loop

How I want it to work and look:
Hand number: ###,###
Plus/minus deck count: ##
Bet: #,###
Players Hand: 19
Cards:
10
4
5
Dealers Hand: 17
9
8
Current Bank: ###,###

Set Multiline = true
now loop through next hand played

With frmBJ
.Text = vbCrLf & "Whatever " & str(an integer) & vbCrLf
.Text same
.Text etc.
end with

Textbox is blank, so I step through code with F8.
Each line displays on row 1, overwriting prior line.
Don't know what else to try to get textbox to display more than a single line.
Crazy making! Any help would be greatly appreciated.
 
frmBJ seems like an unlikely name for a TextBox, however, try;

.Text = .Text & vbCrLf & "Whatever " & str(an integer) & vbCrLf

At the moment you are re-assigning the complete contents of .Text rather than adding to the existing contents.
 
Kind-of, sort-of the same...:

Code:
Dim s As Sting

s = "Hand number: ###,###" & vbNewLine
s = s & "Plus/minus deck count: ##" & vbNewLine
s = s & "Bet: #,###" & vbNewLine
s = s & "Players Hand: 19" & vbNewLine
s = s & "Cards:" & vbNewLine
s = s & "10" & vbNewLine
s = s & "4" & vbNewLine
s = s & "5" & vbNewLine
s = s & "Dealers Hand: 17" & vbNewLine
s = s & "9" & vbNewLine
s = s & "8" & vbNewLine
s = s & "Current Bank: ###,###"
[green]
'Debug.Print s   'You can see what's in s[/green]

frmBJ.Text = s

Have fun.

---- Andy
 
Much thanks. Obvious once it has been pointed out. Couldn't see the forest for the trees. FrmBJ was typo. It's frmBJ.txtD.Text. Am very rusty. First attempt at writing code since 2006.
 
If you are already 'inside' of Form frmBJ with your code, you may consider:[tt]
[blue]Me[/blue].txtD.Text[/tt]
or just simply:[tt]
txtD.Text[/tt]

I am just lazy and if I can avoid typing, I will (in most cases, not always)

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top