Jump to content
Xtreme .Net Talk

Recommended Posts

Guest BDawg
Posted

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. :)

Posted

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).

Guest BDawg
Posted

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

Guest Perl
Posted

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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...