I have JUST started learning basic (as of TODAY, actually) and I get the "basic" gist of it ;) but i have looked everywhere and cannot find out how to make the program do something without the user doing anything. i'm sure it's a simple

Private Sub 'something

, but i just can't find it. any help would be very appreciated.

so, what u want to do exactly?
you want to make a procedure?

>>make the program do something without the user doing anything

Private Sub First()
   Msgbox ("Hello World")
End Sub

You can simply double-click the main form and it wil open something like this:

Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

Every command written inside this sub will run as soon as the app is executed. Just to try, create a empty project and add this to the code:

Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    MsgBox("Hello buddy! I'm showing without your imput! I'll close when you click ok!")
    Me.Close()
End Sub

And run.

thanks, Jx_man. i knew it was something really simple like that.

ok, Jx_man's snippet worked, but there's one problem. The code i have is

Private Sub Command1_Click()
Print "3"
End Sub
Private Sub Form_load()
Print "3"
End Sub

the second "Private Sub" is a variation of your snippet, Jx_man, just with a Print instead of a message box. (that's what i want to do by the way) the first is when a button is clicked. when it runs, and i click the button, th text it prints skips a line, as if the your snippet's text is there but can't be seen.

yeah, i know i should've posted it on the VB thread area, my bad!

you can see the result in the form..at top left corner..
the text is written directly into the form.

so how does the user see it? i certainly cannot

I suggest you to switch to VB.net. Its newer, has more active support and you may find your answers more easily. I might be wrong when I say this, but this is what I think.

I also don't think that the gap between VB and VB.net is big. You might get used to some things, and will abandon some others.

I've read a few time ago about VB and found VB.net way more easy. That's my suggestion. You can get it for free on Microsoft's site, more precisely here.

If you do so, you can try my code and it will work. Besides that, I cannot help you anymore.

why u want to use print function?
if u want to show a message u can use message box or other controls..

i know what a message box is (a little window that pops up and u can only lose or click ok) and that's not what i want. i can print, but not initially, 4 some reason!

ok..so u want to use print function..
as i told u before that result of this function written directly on the form.
this function works fine to me..

an example :
This following code will print "Daniweb" 10 times in the form every time u click it.

Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 10
    Print "Daniweb"
Next i
End Sub

i upload a pic, so u can see if it not appear on your form. :)

ok. let's say this again. when the Private Sub Form_load() is used, and the Print function is done, it does not show up. anywhere else, on like that example, for instance, it shows up fine but skips a line, as if the text from the first "function" (is that what it's called in basic? i'm really a C guy, so...) is hidden from the user or something. do you have any idea what's happening?

try to check on immediate window. after running program, u can see this window on the buttom of vb6.

For vb6 questions, please use this forum.

Ahhhh, this is the vb4/5/6 forum... :)

You can not use the print function in your form load event. If you really want to, use a timer and set its interval to 1 (=0.001 seconds), which will then load the required print "3".

Private Sub Timer1_Timer()

Print "I am here"
Timer1.Enabled = False
End Sub

Ahhhh, this is the vb4/5/6 forum... :)

Was not until I flagged it as a bad post for the vb.net forum and noted to the moderators that it should be moved to this forum. Hope it helps "everyone". :)

Yeah, my bad. Should have realized that, sorry.:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.