?
Solved

How to choose the files I want

Posted on 2003-02-19
6
Medium Priority
?
155 Views
Last Modified: 2010-05-01

I made a program which recordes entries and displays the stuff that I entered earlier and it saves in a file that I specified.
And I made a check box to tick so it will also display on the screen later.
I want to filter the records as checked and not checked. The 'unchecked' stuff saves as "0" and checked
ones save as "1". If i can filter the 0s and 1s then i think it would be easy.

I want to view the checked and unchecked both seperatly.
This is the code I used to view all the records.

 Dim strName As String
  Dim intGrade As Integer
  Dim strText1 As String
  Dim strText2 As String
  Dim splitText() As String

  Open "C:\Program Files\Tax Pending\tax.txp" For Input As #1
     Do Until EOF(1)
          Input #1, strText2 'read entire line
        splitText = Split(strText2, Chr(44)) 'split line by " ' "

        strName = splitText(0)
         'splittext is string, convert it to int
        strText1 = splitText(0)

        Form2.Print strName, intGrade, strText1
     Loop
  Close #1

Its like displaying all of them. I told the program to save the 0s and 1s but didn't tell it to display. I hope u got my question.
  check box name is chkCheckBox1.
0
Comment
6 Comments
 

Expert Comment

by:StonedRaider
ID: 7984099
i dont understand your question quite good but here
Form2.Print strName, intGrade, strText1
your telling it to display it
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 7984119
yes, the

Form2.Print strName, intGrade, strText1

is telling it to display in Form2.  I don't quite understand what you are trying to do either.  It sounds like you have a simply solvable problem, but I don't think you've explained it well enough.
0
 

Expert Comment

by:jpwiedenhoff
ID: 7984935
make like this:

take the separated numbers and put them into an if/else check or select case.
I hope you used indexnumbers for your checkboxes else you have to write the code each time.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
JoaTex earned 80 total points
ID: 7984983
Hi
See if this can Suite You.

form1:
2 Labels
2 ListBoxes (Sorted)
1 Command Button

tax.txp

John,Engeneer,0
Thomas,Web Designer,1
Louis,Sailor,0
Charles,Mechanic,1


Code:

Option Explicit
   Dim strName As String
   Dim strText1 As String
   Dim strText2 As String
   Dim splitText() As String
   Dim strList As String

Private Sub Command1_Click()
   List1.Clear: List2.Clear
   Open "tax.txp" For Input As #1
      Do Until EOF(1)
         Line Input #1, strText2 'read entire line
         splitText = Split(strText2, Chr(44)) 'split line by " ' "
         strName = splitText(0) 'splittext is string, convert it to int
         strText1 = splitText(1)
         strText2 = splitText(2)
         Select Case Val(strText2)
            Case Is = 1
               strList = strName & "      " & strText1
               List1.AddItem strList
            Case Is = 0
               strList = strName & "      " & strText1
               List2.AddItem strList
         End Select
    Loop
 Close #1
 End Sub

Properties:

Begin VB .Form Form1
Caption      =      "Form1"
ClientHeight      =     3075
ClientLeft      =     3285
ClientTop      =     2655
ClientWidth      =     6660
LinkTopic      =      "Form1"
ScaleHeight      =     3075
ScaleWidth      =     6660

Begin VB.ListBox List2
Height           =     1620
Left           =      3390
Sorted           =     -1 'True
Tablndex      =     4
Top           =     630
Width           =     2685
End

Begin VB.ListBox List1
Height           =     1620
Left           =     420
Sorted           =     -1'True
Tablndex      =      3
Top           =     630
Width           =     2655
End

Begin VB.CommandButton Command1
Caption      =      "Load File"
Height           =     375
Left           =     2670
TabIndex      =     0
Top           =     2460
Width           =     1185
End

Begin VB.Label Label2
Caption      =     "Unchecked"
Height           =     225
Left           =     4320
TabIndex      =      2
Top           =     420
Width           =     1035
End

Begin VB.Label Label2
Caption      =     "Cheched"
Height           =      255
Left           =     1200
Tablndex      =     1
Top           =     390
Width           =     825
End
End
0
 

Expert Comment

by:CleanupPing
ID: 8901416
Dileepdhananjayaratanayake:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8959720
Moderator, my recommended disposition is:

    Accept JoaTex's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

609 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