Solved

File access

Posted on 1998-10-25
5
144 Views
Last Modified: 2010-04-30
Ok this is my prob:
I am creating an application whch acts short of a database.
This app consists of a list box and a text box.
What i want to do is have a topic title in the list box and everytime a topic is selected i want a long secription to appear in the text box.
All of this will be stored in a .dat file and will be accessed through the program.
I want this totally under a .dat file not database or anything else.
My only problem is that i only have enough info to do this using only text boxes and not a list box.
Can anyone help me?
0
Comment
Question by:pestilence
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
kamall earned 100 total points
ID: 1441479
Put 2 list boxes and one text box on your form and copy and paste the following code:

Private Sub Form_Load()
   
    List2.Visible = False
   
    List1.AddItem "Item 1"
    List1.AddItem "Item 2"
    List1.AddItem "Item 3"
   
    List2.AddItem "Text of Item 1"
    List2.AddItem "Text of Item 2"
    List2.AddItem "Text of Item 3"
   
End Sub

Private Sub List1_Click()
   
    Text1.Text = List2.List(List1.ListIndex)

End Sub


If you need more help, just comment me.
Regards
0
 
LVL 7

Expert Comment

by:kamall
ID: 1441480
I forgot to mention that when your program starts, you read the topics from the .dat file and put them in List1, and read the descriptions and put them in List2 by using the .AddItem as I show in my code above.
0
 
LVL 1

Author Comment

by:pestilence
ID: 1441481
Yes i need some more help here...
I have done the same thing with the code you gave me..
It's my mistake i should describe it better, i have the code, and know how to add items on my list box and text box.
My main problem is this:
I want the .dat file to contain data in this style:
[Topic]
1=title
2=title
.
[Description]
1=kdlgkjhgkhgd
2=dlkgkjhgdk
.
I just don't know how to access and read data in this kind of format, since the on-line books don't cover any topic with this kind of subject (as far as i have searched at least).
I am really sorry for messing it a bit :), but thats the main problem i have now.
Can you help me?

0
 
LVL 1

Author Comment

by:pestilence
ID: 1441482
Yes i need some more help here...
I have done the same thing with the code you gave me..
It's my mistake i should describe it better, i have the code, and know how to add items on my list box and text box.
My main problem is this:
I want the .dat file to contain data in this style:
[Topic]
1=title
2=title
.
[Description]
1=kdlgkjhgkhgd
2=dlkgkjhgdk
.
I just don't know how to access and read data in this kind of format, since the on-line books don't cover any topic with this kind of subject (as far as i have searched at least).
I am really sorry for messing it a bit :), but thats the main problem i have now.
Can you help me?

0
 
LVL 7

Expert Comment

by:kamall
ID: 1441483
Of course...
Here is the code:

Open "c:\...." For Input As #1
  Do
    Line Input #1, X$
    If X$ = [Topic] Then
      ....Poulate your List1
    End If
  Loop Until X$ = ""   'Blank line

  Do
    Line Input #1, X$
    If X$ = [Description] Then
      ....Poulate your List2
    End If
  Loop Until X$ = ""   'Blank line
Close 1

For any difficulties, leave me a comment.
Regards.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question