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
Solved

hiya its BOLOX again for another quickie?

Posted on 2002-05-17
11
193 Views
Last Modified: 2010-05-02
hmmm, that sounded rude, oh well here is the question:

I usually use a listbox to fill data in and use a click() option to get the reults back....


eg,

 While Not myado.EOF
     List1.AddItem myado!a
     List1.ItemData(List1.NewIndex) = myado!id
     myado.MoveNext
  Wend
  End If

but now i have about 10 columns of text to go in.

i have tried using the listview............



ListView1.ColumnHeaders.Add , , "Airline"
   ListView1.ColumnHeaders.Add , , "Class"
   ListView1.ColumnHeaders.Add , , "From"
    ListView1.ColumnHeaders.Add , , "Via"
     ListView1.ColumnHeaders.Add , , "To"
      ListView1.ColumnHeaders.Add , , "Fare Type"
       ListView1.ColumnHeaders.Add , , "Valid From"
        ListView1.ColumnHeaders.Add , , "Valid To"
         ListView1.ColumnHeaders.Add , , "Validity"
          ListView1.ColumnHeaders.Add , , "Net Adult"
           ListView1.ColumnHeaders.Add , , "Gross Adult"
   ListView1.View = lvwReport
   

   Set results = ListView1.ListItems.Add(, , "one")
  results.SubItems(1) = "one"
   results.SubItems(2) = "three"
    results.SubItems(3) = "three"
     results.SubItems(4) = "three"
   Set results = ListView1.ListItems.Add(, , "one")
   results.SubItems(1) = "one"
   results.SubItems(2) = "three"
    results.SubItems(3) = "three"
     results.SubItems(4) = "three"
     Set results = ListView1.ListItems.Add(, , "one")
   results.SubItems(1) = "one"
   results.SubItems(2) = "three"
    results.SubItems(3) = "three"
     results.SubItems(4) = "three"


this looks good, but, what i want is that when i click on one of the lines for it to goto a new page with the index (pri key) for thsat data entry and to then show all data relating to that.

HOW!!???????

0
Comment
Question by:bolox
  • 7
  • 3
11 Comments
 
LVL 1

Author Comment

by:bolox
ID: 7016108
i know that the listview does not use data at the moent, but it will if it is the correct way forward
0
 
LVL 1

Author Comment

by:bolox
ID: 7016110
something with grid lines like an excel type thing would be better, or at least with columns that would adjust and not have a huge amount of white space
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7016130
When you add an item to the listitems collection the second parameter is a Key field, this can be used to refer to the listitem in future. Whilst it may not work with a purely numeric key, depending on the values in your primary key you can prepose a "Key" & <PrimaryKeyValue> so that it does. When you click on the item the ItemClick event is fired:

Private Sub ListView1_ItemClick(ByVal Item As ListItem)
 'Call another form
 Load frmSubForm
 frmSubForm.Populate Item.Key
 frmSubForm.Show vbModal,Me
End Sub

This pseudo-code shows how to load the form and then call a populate method with the key value of the clicked item, you then show the form with the details.
0
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.

 
LVL 3

Expert Comment

by:Elmo_
ID: 7016137
Bolox,

Why do you not use a flex grid instead.

They are really easy to use and format.

Also, when you have your data loaded into the grid, If you click on a row or cell  You can see what value is in it.

This may help you in going to a new page and showing all the related information.

Hope it helps

0
 
LVL 1

Author Comment

by:bolox
ID: 7016149
flex grid looks much better, and there is an easier way to select a row.

Any pointers as to assign some text to each columns and ading the on_click method???

MORE POINTS IF YOU DO
0
 
LVL 1

Author Comment

by:bolox
ID: 7016151
SORRY BUT I ONLY HAVE ANOTHER 3 POINTS AVAIL NOW, SO THIS 50 IS ALL I CAN OFFER
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 7016178
Ok, to add text to a specific row/col in a flexgrid:

MSFlexgrid1.TextMatrix(3,7) = "Hello Bolox"

Sets row 3, column 7 equal to "Hello Bolox"

To get the value selected back out:

Private Sub MSFlexGrid1_SelChange()
    MsgBox MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, MSFlexGrid1.Col)
End Sub
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7016179
Or if you really want to use the Click event:

Private Sub MSFlexGrid1_Click()
    MsgBox MSFlexGrid1.TextMatrix(MSFlexGrid1.MouseRow, MSFlexGrid1.MouseCol)
End Sub
0
 
LVL 1

Author Comment

by:bolox
ID: 7016259
on entering ..

MSFlexGrid1.TextMatrix(3, 7) = "Hello Bolox"

it says it is out of range?
0
 
LVL 1

Author Comment

by:bolox
ID: 7016265
ignore that, i forgot to add more cols and rows
0
 
LVL 1

Author Comment

by:bolox
ID: 7016270
well done. your guys and gals are the best, shame i have no points left again. just havew to answer some more questions for a change then

Thanx again

Gavin AKA Bolox
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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 I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 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