Guest BDawg Posted May 17, 2002 Posted May 17, 2002 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 they've taken the print ability of the picture box out of .NET, and I'm very confused. The upgrade wizard told me I need to be using the creategraphics extension of the picturebox, but I can't 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 isn't the point to stay away from the console? Shouldn't I be able to display and format text in my forms? What's the new way of outputting and formatting text on screen? I'm sure this is an easy question for the vb gurus out there. :) Quote
Spike Posted May 17, 2002 Posted May 17, 2002 try this: 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). Quote
Guest BDawg Posted May 17, 2002 Posted May 17, 2002 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 can't 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 don't get adding variables and arrays in .NET Quote
Guest Perl Posted May 18, 2002 Posted May 18, 2002 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.