.NET noob question - picOut.print

  • Thread starter Thread starter BDawg
  • Start date Start date
B

BDawg

Guest
In VB 6, I was trained to display lines of text in a picturebox. In one line, you could mix text with variables as follows.

picOut.print "The number in the array is"; Tab(30); array(i)

Now theyve taken the print ability of the picture box out of .NET, and Im very confused.

The upgrade wizard told me I need to be using the creategraphics extension of the picturebox, but I cant seem to use variables in it.

I tried using a textbox and a label (as I was forbid to do in vb6), but could not figure out how to put them all in the same line...neither recognise the ; .

Some of the tutorials online show practice problems using the console, but isnt the point to stay away from the console? Shouldnt I be able to display and format text in my forms?

Whats the new way of outputting and formatting text on screen? Im sure this is an easy question for the vb gurus out there. :)
 
try this:

Code:
Dim B As Brush = New SolidBrush(Color.Green)
Dim F As Font = New Font("Comic Sans MS", 10, FontStyle.Regular)
Dim G As Graphics = Me.CreateGraphics

G.DrawString("Spike was here", F, B, 70, 70)

This will draw "Spike was here" is solid green, in font Comic Sans, size 10, at position (70,70).
 
Yeah, I get that part...but what if I wanted to put an array stored string after that.

Such as if I had the array when(0 to 3)

when(0) = friday
when(1) = saturday
when(2) = sunday
when(3) = monday

I cant just say

G.DrawString("Spike was here on"; when(1), F, B, 70, 70)

that was allowed in VB6 using the picurebox.print command.

I get plain text...I just dont get adding variables and arrays in .NET
 
I think you are missing the whole concept of string concatination here... its the process of adding strings together...

*btw who ever told you to use the pic box exclusivly other then labels and text boxes was asinie... shoot them for me :) *

Dim myString_1 as String = "HiLo My NaMe Is"
Dim myString_2 as String

myString_2 = myString_1 & " Perl"

You can do the same thing in functions, just remember though that it is looking for strings so when working with variables its best to surround it with CStr (I dont remember the VB.Net more specific way of accomplishing this i will get back to ya)

Hope This Helps,

P.S Any questions AiM me :)
 
Back
Top