Ok I mainly use Liberty BASIC, which is very, very similar to Visual BASIC, and I am having a hard time with a program. I made my program take a user's input, and save it in a text file, like so:

Username=Name,Phone#,Email
John Doe=John Doe,000-0000,email@email.com

But that isn't my problem. The problem is, is that I want the program to allow someone to type in "John Doe" and display it like so:

Username: John Doe
------------------------
Name: John Doe
Phone #: 000-0000
Email Address: email@email.com

Please explain in detail, in any BASIC language(s) that you may know, it doesn't matter, they are all similar!

Recommended Answers

All 7 Replies

#1: Never bump your messages!!!! People will respond when they see it, and 5 hours is not a long time.

#2: If all Basics are so similar, there is no detail needed. And since you already know they are similar, why are you asking? And where do you get your info that they are similar? They aren't that close in my experience....

The rudeness of some people on this forum floors me.

gamingfan1993, here's a rough sketch (in QBASIC):

INPUT "User to look up: ", lookup$

OPEN "data.txt" FOR READ AS #1

lengthoflookup% = LENGTH(lookup$)

WHILE NOT EOF(1)
  LINE INPUT #1, buffer$
  IF LEFT$(buffer$, lengthoflookup%) = lookup$ THEN
    username$ = LEFT$(buffer$, lengthoflookup%)
    realname$ = MID$(buffer$, lengthoflookup% + 2, lengthoflookup%)
    phonenumber$ = MID$(buffer$, lengthoflookup% * 2 + 4, 8)
    email$ = MID$(buffer$, (lengthoflookup% * 2) + 14, (lengthoflookup% * 2 + 14) - lengthoflookup%)
    BREAK
WEND

PRINT "Username: "; username$
PRINT STRING$(20, "-")
PRINT "Name: "; realname$
PRINT "Phone Number: "; phonenumber$
PRINT "Email: "; email$

CLOSE #1

My suggestion, get away from BASIC languages - they get you into a lot of bad habits.

I also agree with that advice look for vb or more advance language

Nice one, I was going to drop in a few of my favorite VisualBasic/QuickBasic library functions and show how to use the first line as a format specifier for the rest of the file, but liberty basic I remember has a weird sub style of whose memory I've tried to forget the horror...

Speaking of horror is there a way to take the address of a QuickBasic Function or Sub, once I have my pointer to function loaded with the address I know how to call it, but...

I don't mind coding in assembly, if I had some idea what I was trying to do?

I've thought about making the sub call an asm proc walking the stack to find the calling sub then rewinding the code to find the a stackframe push. but I don't have any idea exactly how I would write something like that...

If you use liberty basic then use liberty basic forum http://libertybasic.conforums.com/ Im not saying dont come to daniweb but the people at LB forum might be able to help you more in relation to liberty

Ok I mainly use Liberty BASIC, which is very, very similar to Visual BASIC, and I am having a hard time with a program. I made my program take a user's input, and save it in a text file, like so:

Username=Name,Phone#,Email
John Doe=John Doe,000-0000,email@email.com

But that isn't my problem. The problem is, is that I want the program to allow someone to type in "John Doe" and display it like so:

Username: John Doe
------------------------
Name: John Doe
Phone #: 000-0000
Email Address: email@email.com

Please explain in detail, in any BASIC language(s) that you may know, it doesn't matter, they are all similar!

Try this:

Sub main()
    Dim name As String
    Dim phone As String
    Dim email As String
    
    name = InputBox("Enter name: ")
    phone = InputBox("Enter phone: ")
    email = InputBox("Enter e-mail: ")
    
    Call MsgBox("Name = " & name & ", phone = " & phone & ", E-mail = " & email)
    
End Sub

Hoppy

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.