Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Don't understand this

Don't understand this

Don't understand this

  I am looking at some codes stepping through them trying to learn more about VB and how it works. I am following this code which i have learned alot from but i don't understand this part.
    Here is part of it:

 For C = 1 To d: DA$(C) = "": Next
TK3PicType.List2.AddItem tempA$   <<<This is the  problem
GoTo getit2 <Back Here                      
End If
Close 1

The first time it runs this it jumps to TK3PicType form and goes to this:
 Private Sub Form_Load()
RefreshList.Visible = False
List1.AddItem "Select memory size"
List1.AddItem "to speed disassembly"
List1.AddItem "when required data is"
List1.AddItem "known to be less than"
List1.AddItem "the PIC's capacity"
List1.AddItem ""
B = 100: List1.AddItem (Str$(B) & Chr(9) & "commands")

B = 250
For A = 1 To 32
List1.AddItem (Str$(B) & Chr(9) & "commands")
B = B + 250: Next
Label5.Caption = "Device currently selected " & PICdevice
End Sub

Then it goes back to GoTo getit2. It works but i don't understand why the first time through it goes to the sub form folder of TK3PicType form. But it does not go to the form the next time it is run. It does execute TK3PicType.List2.AddItem tempA$  then goes straight to GoTo getit2. This happens when i step through it.
 Also the code it executes are for List1. Why is it even going to Private Sub Form_Load()?

i figured it means
    Go to TK3PicType, then to list2 of that form and additems to the list for list2.?

RE: Don't understand this

It's difficult to know where to start with this!
The code you show, although it looks like VB, is a bit odd to say the least. Looks as if it's been converted from an old BASIC program by someone who doesn't understand Windows interactions.
1. Use of colon as a statement separator is legal, but unusual
2. GoTo is normally only used in error handling code
3. A ListBox is a selection tool. It looks like it's being used here as a TextBox

You don't show enough code for us to know what's happening, like what Getit2 does.

The way that VB works is that code is only fired by some action - it doesn't just run. The code in Private Sub Form_Load() runs every time the form is loaded. The code in a Click event is fired when the control is clicked etc.

TK3PicType.List2.AddItem :
TK3PicType is probably a Form Name
List2 is probably a ListBox on that form
AddItem is a Method of that control

Rather than continue to labour under these misapprehensions, I suggest you go to one of the tutorial sites to start with. Try:
That will get you started with the basics, certainly so that you understand the concept of Forms and Controls, and their Methods, Events and Properties.

When you've read that and got the hang of the basic stuff, come back with specific questions if you need more help

Good Luck
To get the best from these forums read FAQ731-376 before posting

Steam Engine enthusiasts: www.essexsteam.co.uk

RE: Don't understand this

Is this source code from the EPE TK3 PIC programming utility?

RE: Don't understand this

Hello Zeitghost,

   Yes it is. Just trying to understand how they are doing things in it.
   I believe that Johnwm is right though . It was probably converted from qbasic, not that i am complaining, still want to learn but i don't understand why this happened and there are other areas that do this.

Thank all of y'all for your replys,
Merlin Knight

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close