Highwayman

Being new to Visual Basic and forms development I am trying to learn the various
aspects of the Form development tools I am currently using the Visual Basic Express 2005 IDE.

I have forms that import xml files and stores the data in Access databases.

The main form allows the selection of the Import Form that will be used, these
forms contain the processing for the different types of xml -> Access databases
i.e. ImportBooksForm, ImportFaceBookForm and so forth.

The main form works well however, I would like to use a ListView instead of the
current controls. I have tried a number of ways to use a listview but keep getting
various errors. I have spent a fair amount of time reading the Help system and
searching for examples and Q&A on the MSDN forums but still have not been able
to get it to work.

I would like some help with this and would appreciate any good reference sources
that would be helpful.

Current objects and controls.


Access Database Tables
ImportForms
form_id
autonumber, long integer, primary key
form_name text (indexed no duplicates, required)
description text (required)
default_form boolean (True/False) Default = False

ImportFolders
folder_id
autonumber, long integer, primary key
form_id long integer FK ImportForms
import_source_folder text (indexed no duplicates, required)
import_move_folder text (indexed no duplicates, required)

ImportedFiles
file_id autonumber, long integer, primary key
folder_id long integer FK ImportFolders
file_name text (required)
import_date datetime
status text

Databindings
ImportFormsTableAdapter
ImportFormsDataset
ImportFormsBindingSource
ImportFolderTableAdapter
ImportFolderBindingSource

Form Controls
FormNameListBox Bound to ImportFormsBindingSource
DescriptionTextBox Bound to ImportFormsBindingSource
DefaultFormCheckBox Bound to ImportFormsBindingSource
ImportFolderButton Opens a FolderBrowserDialog
ImportFolderTextBox Bound to ImportFolderBindingSource
MoveFolderButton Opens a FolderBrowserDialog
MoveFolderTextBox Bound to ImportFolderBindingSource



Re: Visual Basic Language Using ListView to interact with databases.

RMS81

If your ideia is to use the listview to show your data like in a datagrid. Heres an example:

First you have to set the property "view" form the listview to "Details". You can that from the properties window.

Then you add columns to the listview, and define their names and sizes:

Code Block

Listview1.Columns.Add("Column 1", 150, HorizontalAlignment.Left) ' Add a column, set the name the will apear in the listview, the size anda alignment)

Listview1.Columns(0).Name = "Col1" ' Set the name of the column so that you can call it.

Listview1.Columns.Add("Column 2", 269, HorizontalAlignment.Left)

Listview1.Columns(1).Name.Name = "Col2"

Then you can populate it with data from your dataset

The first column will be a listview item, the other will be a subitems of the first. In here Im using a dataview, but using a dataset is not very diferent:

Code Block

Listview1.Items.Add((dtview.Item(intCounter).Item("DataSet_Column 1"))) ' Here you must use the names of the fields in your dataset

Listview1.Items.Item(intCounter).SubItems.Add(dtview.Item(intCounter).Item("DataSet_Column 2"))

Hope this could help





Re: Visual Basic Language Using ListView to interact with databases.

Highwayman

Thank you RMS81, it seems to be quite an involved process I will try it.