Adding Items To A Listview (report Style)
hi,
i would like to know.. (ive created 4 columns) how to add items into the different columns. Hope im clear.. thank you very much
lrm91
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Populate A ListView From A DB Adding Column Headings In Report Style?
I'm currently using ADO to connect to my DB. I want to populate a ListView(Report)with data from a table chosen from a CommonDial. but i don' know how to assign the ColumnHeadings as well as add the data. I want my program to be able to file out all the info in the ListView automaticaly once opened.(Tables I no nothing about?!?)
Adding Items To A Listview Called Report
Hey guys I would like to clean up my listbox and get a listview called report.
I set up the columns like this .
Report.ColumnHeaders.Add , , "Problem Filename", 2000
Report.ColumnHeaders.Add , , "Problem Name", 3000
Report.ColumnHeaders.Add , , "Type of Problem", 3000
Report.ColumnHeaders.Add , , "Severity", 3000
Report.ColumnHeaders.Add , , "Description of Problem", 3000
Is there a way to get it so when I press a button every item in my list 6 is clicked on , one at a time.?
ListView (Report View) - Adding Items
AH! This is embarassing yet very frustrating. The last time I worked with the list view control was a loooong time ago. Unfortunately, I lost that project when my computer crashed (no big deal really, the program was never even completed). At any rate, how the heck do I add subitems and items to a report view listview?!
eg
Column 1 Column 2
Add Item Add Item
Add Item Add Item
Adding Pics And Style To Menu Items ???
Hi
I wanted to add pics and different style in the Menu of my Application.Ie Gradient, Office Xp etc.
I think a set of Api's do that but Not sure Fully, Thats why I posted it in General.
Please look at the Screenshot and Let me know , How to make the Menu as shown in the Picture.
Thanks in advance !!
Regards
Er. Gurpreet Singh
C.E.O Sukhmani Software
New Delhi
Difficult Things are Those that can be done Instantly.
Impossible things are those which take little long - Unknown
Listview Report Style
I am using a listview set on report style to show data that is inputted/obtained..
The only problem is i can only get data to go into the first coloumn, not the second, third or fourth...
Does anyone know how to input data in a listview control on columns other than the first??
Thanks in advanced..
ListView Adding Items.
Code:
Private Sub Form_Load()
With ListView1
.ColumnHeaders.Add Text:="Server"
.ColumnHeaders.Add Text:="Ram"
.ColumnHeaders.Add Text:="CPU"
.ColumnHeaders.Add Text:="C:"
.ColumnHeaders.Add Text:="Ping"
.View = lvwReport
End With
End Sub
i have this code to give the listview1 5 diffrent columns.
can someone give me the code that when command1 is clicked, it will add a row underneath the columns in this order:
server1
ram1
cpu1
c:1
ping1
just so i know how to do this.
Adding N Items Into ListView
I am using following code to add records read from a text file into a ListView object.
Code:
Dim S
Dim SP
Dim i
Dim LItem As ListItem
i = 1
Open App.Path & "dataspdates.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, S
SP = Split(S, "+", , vbTextCompare)
Set LItem = ListView1.ListItems.Add(, , SP(0))
LItem.SubItems(1) = SP(1)
i = i + 1
Loop
Close #1
My ListView Control has just two columns, and the text file contains records like:
3/10/04+Mr.D Birthday
6/1/04+Mr.C.Anniversary
In the above code, SP will store the splitted line read from the file. The problem is that the above code displays an error "Subscript out of range", at the line starting with "Set LItem".
How to keep adding records to ListView till EOF.
Adding Items To A Listview
I have searched thru the forum, just cant find what im looking for. this is the layout of my listview
Fkey | Action
I wish to add items to the fkey column, and also text to the action clolumn.
listview1.ListItems.Add.Text = "blah" <-- i tried that, but that only goes in Fkey...
How would i do this please,
Thanks
Adding Items To Listview + Ram
Im adding alot of items to a listview (probably 20k rows, 11 columns)
Also, I'm a reporticon and a smallicon to the listview at the same time. Is this grounds enough for the ram that it takes up? It grows by 100k every couple of seconds ( at about 3k rows it has 30mb of ram)
Or is my program leaking by chance?
Adding N Items Into ListView
I am using following code to add records read from a text file into a ListView object.
Code:
Dim S
Dim SP
Dim i
Dim LItem As ListItem
i = 1
Open App.Path & "dataspdates.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, S
SP = Split(S, "+", , vbTextCompare)
Set LItem = ListView1.ListItems.Add(, , SP(0))
LItem.SubItems(1) = SP(1)
i = i + 1
Loop
Close #1
My ListView Control has just two columns, and the text file contains records like:
3/10/04+Mr.D Birthday
6/1/04+Mr.C.Anniversary
In the above code, SP will store the splitted line read from the file. The problem is that the above code displays an error "Subscript out of range", at the line starting with "Set LItem".
How to keep adding records to ListView till EOF.
Listview Adding Items?
is there a way to make it so when adding items to the listview, it will know to go to the next line if there's already data on the previous line? here's my code of what i have so far, but sometimes it adds blank spaces to the listview control, and i dont even know why.
Code:
Label1.Caption = Label1.Caption + 1
Dim lstEntry As ListItem
ListView2.ListItems.Add , , Label1.Caption
ListView2.ListItems.Item(Label1.Caption + 1).SubItems(1) = txtName
ListView2.ListItems.Item(Label1.Caption + 1).SubItems(2) = TxtLName
Adding Items To Listview...
..whats the deal with it? I only want to add say 4 columns, and under each column about 5 items. But there seems to be no way that i have tried to get it to work.
Thanks for any help
Adding Items To Listview?
I have a listview on my form, and on load I tried this:
ListView1.Items.Add("List item text", 3) 'From MSDN
it does not work, so how do I add rows to the listview (report style).
*I got it from "Microsoft Windows Common Controls 6.0 (SP4)
Do I maybe need a newer SP or something...?
Adding Items To Listview Box
Can someone please show me how to select an item from a listview box and add it to another listview box. Both listview boxes have three columns.
Adding Items To A Listview Box
Is it possible to add items to a ListView Box from another ListView box using a command button ? If so can someone show mw an example please ?
(My listview box contains 3 columns).
Listview (adding Items)
this keeps giving me an error on the "listview1.listitems.add file" line, please help:
------------------------------------------------------
File = text1.text
Open App.Path & "/list.txt" For Input As 1
Do Until EOF(1)
Line Input #1, File
ListView1.ListItems.Add File
DoEvents
Loop
Close 1
------------------------------------------------------
I am probably doing this the completely wrong way, but I am used to using listbox's.
LISTVIEW - Adding Items... How???
Hey,
Just wonderin' if anybody has any coding for adding to a LISTVIEW control...
Other coding for the LISTVIEW would be good to, but please post coding on how to add items.
Adding Items To Listview ...
When i add items to listview ... my forms get "disabled" or at least i cannot click any button on the form or anything
another question: how do i stop a function for example if i want to stop the additems function ...
thanks,
Populating A Listview From Txt, Report Style?
Hm messed around with this for some time but no luck so far.
The idea: Open a text file with this delimter ; and get 5 columns filled with the data.
Columnheaders are: Date, Time, Airline, Type, Path
Can anyone come up with something because i haven´t got a clue right now
Kind regards
Frank
Database To Listview Report Style HELP!
Ok,
I have my database setup, each record has five columns, now I want to put them is a listview style report, but using the VB listview control is very VERY slow in sorting and updating. Is there a control I can use with the same functions as listview to display my database entries quickly, must be able to list icons on the report rows...
I added 1000 entries to my database, and my current way of loading the entries took 8 seconds, way to slow, this also goes for column header sorting on the listview box.
If anyone is familar with Forte Agent, I would like a report list similar to that program????
Any help would be nice
More Listview Questions - Adding Items
Code:
Set itmx = ListView1.ListItems.Add(, , quantity)
itmx.SubItems(1) = itemnumber
itmx.SubItems(2) = description
itmx.SubItems(3) = price
itmx.SubItems(4) = total
what are the two comas for in the first line? .Add(, , quantity)
and im ending up with an extra cell at the end with this code, anyone know why? and how can i preset certain sizes for each cell/column? i want description a little longer than the others
Code:
Dim itmx As ListItem
Dim colx As ColumnHeader
Set colx = ListView1.ColumnHeaders.Add(, , "Quantity")
Set colx = ListView1.ColumnHeaders.Add(, , "Item Number")
Set colx = ListView1.ColumnHeaders.Add(, , "Description")
Set colx = ListView1.ColumnHeaders.Add(, , "Price Each")
Set colx = ListView1.ColumnHeaders.Add(, , "Total")
ListView1.View = lvwReport
Adding Items To ListView (comctl32.ocx)
Ok, I've been using mscomctl.ocx for my ListView. However, by accident I discovered that comctl32.ocx uses the XP theme when called upon, and the mscomctl.ocx does not.
So I figured it would be as easy as swapping my controls... nope. I am continually getting Type mismatch errors when I use this code:
Code:
Set litem = frmMain.lstFuel.ListItems.Add(, , Trim(fuelrs.Fields(0)))
litem.ListSubItems.Add , , Trim(fuelrs.Fields(2))
litem.ListSubItems.Add , , Trim(fuelrs.Fields(3))
litem.ListSubItems.Add , , Trim(fuelrs.Fields(4))
litem.ListSubItems.Add , , Trim(fuelrs.Fields(5))
It errors on the first line. What is going on?!
Adding All Items From A Listview To A Listbox?
Hey guys I have two forms.
The antivirus form has a listview called report.
I have another form called antiignore that has a list1 listbox. Is there a way to get it so when I load the antiignore form, the items that are in the listview report goes in the list1?
Thank you!
Adding Array Items To Listview
Hi,
Can somebody please tell me how to add an array student(i) to a listbox Listbox1 ?
Im struggling with this as i usually work with listboxes but i want to be able to change the listview values icons dynamically depending upon an excel range.
Thanks,
Dan
Listview - Adding Items Problem
Hi,
Can anyone please assist me with the following question.
I have a listview and its view is set as lvwreport.
My problem is with the listview. When I click on a data item in the listview, and then try to add data it seems to mix up my data.
For example. (Listview data)
I have 2 columns
Name Age
John 22
Alan 21
Fay 23
If I select say Alan and then try to add data, my program then seems to add the name to where the location of where alan is and adds then age to where Johns age is. Name to add will be Kirsty , age of 25
Example of output
Name Age
John 25 (kirsty's age ends up here)
Kirsty (data missing)
Alan 21
Fay 23
Part of the source code is;
With lstUsers.ListItems
.add (1), , TxtName
.Item(1).SubItems(1) = txtAge
End With
I have also tried this;
dim a as integer
a = lstprocess.ListItems.Count
With lstUsers.ListItems
.add (a), , TxtName
.Item(a).SubItems(a) = txtAge
End With
Can anyone please explain why this is happening, and how can I go about getting the data entered in correctly. Also I would appreciate it if someone could also advise in how I can get the data showing in ascending order, once the name and age has been entered.
Any help is appreciated.
Thanks.
Al.
Adding Items In Columns In A Listview
Hello
I am using a listview control that l want to add items to. The Listview contains 2 columns. One for name and the other for price. The name and price will be input by using a text box. When the user presses the command button the 2 will be added to the listview box.
I am not sure how to add 2 items into the two columns.
My code so far.
Code:
'Create the listview headings
ListView1.ColumnHeaders.Add , , "Name of Fruit"
ListView1.ColumnHeaders.Add , , "Price of Fruit"
ListView1.View = lvwReport
'Code adding to the listview box, but not sure how to add price
Set objfruit = ListView1.ListItems.Add(, , name.Text)
Many thanks in advance
Steve
**RESOLVED**Adding Items To ListView
I have a Table with two fields: Item Name & Item Price...would like to add all the items that are there in these two tables...I wanna create two columns in ListView and...add...any help!!!
Adding Items To ListView Control???
Hello!!
I have a ListView control woth 2 columns namely "Code" and "Description " respectively.
How do i add items the ListView Control programatically.
thanx
Getting Error In Adding Items To Listview
i am getting error in adding listview items.it says that i have to attach
the imagelist to the listview first before adding the items. ia m trying to
add the items of recordset into the listview. and another problem is there
if i am opening list view in report mode then i am not getting the
checkboxes.....please solve it..its urgent.
my code is as follow..
Private Sub Command1_Click()
Dim litem As ListItem
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
With Adodc1.Recordset
While Not .EOF
Set litem = ListView1.ListItems.Add(, , .Fields(1), 1)
litem.SubItems(1) = .Fields(2)
litem.SubItems(2) = .Fields(3)
litem.SubItems(3) = .Fields(4)
litem.SubItems(4) = .Fields(5)
litem.SubItems(5) = .Fields(8)
.MoveNext
Wend
End With
End Sub
Private Sub Form_Load()
Dim lheader As ColumnHeader
Dim litem As ListItem
ListView1.Icons = Nothing
lwidth = ListView1.Width - 6 * Screen.TwipsPerPixelX
ListView1.ColumnHeaders.Add 1, , "Subkapan", lwidth / 6, , ColumnHeader
ListView1.ColumnHeaders.Add 2, , "lot no", lwidth / 6, , ColumnHeader
ListView1.ColumnHeaders.Add 3, , "than", lwidth / 6, , ColumnHeader
ListView1.ColumnHeaders.Add 4, , "weight", lwidth / 6, , ColumnHeader
ListView1.ColumnHeaders.Add 5, , "quality", lwidth / 6, , ColumnHeader
ListView1.ColumnHeaders.Add 6, , "expected_per", lwidth / 6, ,
ColumnHeader
ListView1.View = lvwReport
End Sub
Adding Items To Listview In Reverse Order
can anyone tell me how i can add items to a listview so the new item you are adding is at the top of the list, rather than at the bottom? i want the oldest/ first item added at the bottom, with the newest item always at the top of the list.
any help would be greatly appreciated.
gkc
Read Text File And Display In Listview Report Style
I run a command netstat -a > text.txt
and get the result as below:
Active Connections
Proto Local Address Foreign Address State
TCP p2:1030 P2:0 LISTENING
TCP p2:80 P2:0 LISTENING
TCP p2:135 P2:0 LISTENING
TCP p2:6543 P2:0 LISTENING
TCP p2:443 P2:0 LISTENING
TCP p2:1032 P2:0 LISTENING
TCP p2:1032 APIITNT:nbsession ESTABLISHED
TCP p2:137 P2:0 LISTENING
TCP p2:138 P2:0 LISTENING
TCP p2:nbsession P2:0 LISTENING
TCP p2:1028 P2:0 LISTENING
TCP p2:1029 P2:0 LISTENING
TCP p2:1031 P2:0 LISTENING
UDP p2:6543 *:*
UDP p2:nbname *:*
UDP p2:nbdatagram *:*
Now I want write a porgram to read the test.txt and
display in a listview with four column, which is same with above.
How can I display the result?
Can anyone help me???
thanks
Adding Items To Listview From Different Sets Of Text And Combo Boxes..
I am making a PC inventory system.
So here's what I am trying to do.. I am trying to add items from different sets of
text and combo boxes to a single listview, the columnheader set of the listview also change depending on the item selected on the listbox.
Listbox containing the hardware type, as we all know different hardware types has a different specs, for example a RAM that has a type, name of the ram, brand, RAM size and a Modem that has a only a modem name, brand..
Changing the columnheader set is working fine as the text and combo boxes that available when a specific hardware item is selected, now I am making a hard time putting the items on the listbox..
Its not like a code problem, but kinda logical one..
your help is always appreciated..
thanks in advance
Listview Report Moving Items Up && Down
Hi everyone ,
I know how to move the first column field up and down in a listview report.
But now i have 10 columns and the user wants to select a row and puts it one down (if its not already at the bottom) or one up (if its not already at the top).
thx
Help: How To View Selected Items From Listview With Crystal Report Viewer
Hi
I have a Listview with check boxes from it want to view selected items with crystal report viewer.
Private Sub cmdView_Click()
Dim lCustomerId as Long
Dim tmpItm As ListItem
For Each tmpItm In lstItems.ListItems
If tmpItm.Checked = True Then
lCustomerId = Val(Replace(tmpItm.Key, "C", ""))
End If
Next
End Sub
Plz. help
regards
Loop The Loop: Adding List Item And Sub-items Assigned To Items.
Hello there,
below are the codes i've written to record all the items (which are qnsID) in list box (List1) into qnsdata_table.
Code:
Private Sub Command6_Click()
Dim x As Integer
Dim y As Integer
x = List1.ListCount
y = 0
rst.Open "SELECT * from qnsdata_table", cn, adOpenDynamic, adLockOptimistic
Do While Not y = x
rst1.Open "SELECT qnsdataID from autonumber", cn, adOpenDynamic, adLockOptimistic
rst.AddNew
rst!qnsDataID = "qd" & Right("000000" & CStr(CInt(rst1!qnsDataID) + 1), 6)
rst!qnsID = Me.List1.ItemData(y)
rst.Update
rst1.Close
rst1.Open "UPDATE autonumber SET qnsdataID = qnsdataID +1", cn, adOpenDynamic, adLockOptimistic
y = y + 1
Loop
rst.Close
End Sub
The problem is that for each item (qnsID) there are several assigned (ansID) and i need them to be recorded along with the qnsID, into qnsdata_table.
______________________________
| qnsdataID | qnsID | ansID |
-----------------------------------
| qd0001 | qns0002 | ans0012 |
| qd0002 | qns0002 | ans0016 |
| qd0003 | qns0002 | ans0001 |
------------------------------------
In this case, should i have another Do While Loop within the current Loop, to find out how many 'ansID' there are which are assigned to each 'qnsID'.
I've tried
Code:
rst2.Open "SELECT Count(ansID) AS ansID_count FROM ans_table where....(conditions)
Me.Text2 = rst2!ansID_count '(ive no idea where to store the count) value)
a = Me.Text2 '(shift value into variable a)
b = 0
and here goes another loop, but it didn't work.
Need some advice and comments from you guys =)
Thanks a million.
Astrov
Searching Styles And Adding Another Style
If I have some text that is styled as heading 1, for example.
Can I create a macro that will search for any text that is styled as heading1, and if it doesn't have a space after the text, have the macro add a space styled as Normal after the heading1 text.
So if I have:
HEADING1
Convert it to:
HEADING1 (normal space)
Is this possible?
Regards,
Digger
HELP HELP HELP ListView Style
How to set style of listview with LVS_NOSORTHEADER?
So, what am I doing wrong?
Here's the basics of my code:
'API Declarations
Public Declare Function GetWindowLong Lib "user32"
Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex
As Long) As Long
Public Declare Function SetWindowLong Lib "user32"
Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex
As Long, ByVal dwNewLong As Long) As Long
'Constants
Public Const GWL_STYLE = (-16)
Public Const LVS_NOSORTHEADER As Long = &H8000&
'Some Code Here
SetWindowLong TheListView.hwnd, GWL_STYLE, GetWindowLong
(TheListView.hwnd, GWL_STYLE) Or LVS_NOSORTHEADER
'Some More Code Here
Listview Style LVS_NOSORTHEADER
How to set style of listview with LVS_NOSORTHEADER?
So, what am I doing wrong?
Here's the basics of my code:
'API Declarations
Public Declare Function GetWindowLong Lib "user32"
Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex
As Long) As Long
Public Declare Function SetWindowLong Lib "user32"
Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex
As Long, ByVal dwNewLong As Long) As Long
'Constants
Public Const GWL_STYLE = (-16)
Public Const LVS_NOSORTHEADER As Long = &H8000&
'Some Code Here
SetWindowLong TheListView.hwnd, GWL_STYLE, GetWindowLong
(TheListView.hwnd, GWL_STYLE) Or LVS_NOSORTHEADER
'Some More Code Here
Combine 2 Listview Items Into One Listview
I have 2 listviews that have a different listitems.
ex.
LV 1 LV 2
1. A 1. B
2. C 2. D
3. E 3. F
Is there a way to combine the 2 to another listview so that they all look like this with out doubles of matching items?
ex.
LV 3
1. A
2. C
3. E
4. D
5. E
6. F
Combine 2 Listview Items Into One Listview
I have 2 listviews that have a different listitems.
ex.
________________
LV 1 l LV 2 l
l l
1. A l 1. B l
2. C l 2. D l
3. E l 3. F l
_______l_________l
Is there a way to combine the 2 to another listview so that they all look like this with out doubles of matching items?
ex.
_______
LV 1 l
1. A l
2. C l
3. E l
4. D l
5. E l
6. F l
_______l
Code: DC++ Style Progress Bar In Listview
Hi guys!
I just thought i'd share my latest discovery with you. This code is far from optimal, so don't attempt any plain Cut'n'paste to your code But you could probably tweak something out of it. If not, it's at least a good beginners example of drawing stuff onto other controls.
The reason i tried this out was that i could find no information on the net about this (did a quick search, so i may have missed something), so i tried to figure out how i could make one of my own... And here is the result
You need to have some code to trigger redrawing, i would recommend a timer for this purpose, and also some code to handle unique events such as item selection (which should preferably just redraw the selected row) and perhaps some subclassing to intercept the paint requests for the control.
You need a picturebox named picRender with autoredraw set to true, appearance flat, no border, and of course invisible. Scalemode should be vbTwips.
index = row index (or key) of item to set the progressbar for
column = what column (index, not key) to place the progressbar
maxval = the maximum possible value for the bar
curval = current value
Code:
Private Sub RenderProgressBars(index,column,maxval,curval)
Dim lngListviewDC As Long
Dim intTop As Integer, _
intHeight As Integer, _
intColOffset As Integer, _
intColWidth As Integer
Dim intItem As Integer
Dim px as integer, _
py as integer
Dim mw as integer, _
sc as single
lngListviewDC = GetDC(Me.lvwProgress.hWnd)
intTop = Me.lvwProgress.ListItems(index).Top
intHeight = Me.lvwProgress.ListItems(index).Height
for n% = 1 to column - 1
intColOffset = intColOffset +Me.lvwProgress.ColumnHeaders(n%).Width
next n%
intColWidth = Me.lvwProgress.ColumnHeaders(column).Width
Me.picRender.Cls
Me.picRender.Width = intColWidth
Me.picRender.Height = intHeight
px = Screen.TwipsPerPixelX ' pixel/twips ratios
py = Screen.TwipsPerPixelY
mw = (intColWidth - 4 * px) ' maximum width
sc = mw / maxval ' scale
Me.picRender.Line (0, 0)-(intColWidth, intHeight), RGB(255, 255, 255), BF
Me.picRender.Line (1 * px, 1 * py)-(intColWidth - 2 * px, intHeight - 2 * py), RGB(230, 230, 230), BF
Me.picRender.Line (1 * px, 1 * py)-(intColWidth - 2 * px, intHeight - 2 * py), RGB(40, 40, 40), B
Me.picRender.Line (2 * px, 2 * py)-(sc * curwal, intHeight - 4 * py), RGB(180, 180, 230), BF
BitBlt lngListviewDC, intColOffset / px, intTop / py, intColWidth / px, intHeight / py, Me.picRender.hDC, _
0, 0, RasterOpConstants.vbSrcCopy
End Sub
Keep in mind that i just ripped this part out of my sourcecode and edited it briefly, so it may contain some minor bugs. But with some tweaking it should work
Cheers,
Christopher
#Adding CheckBox Style To FileListControl && Loading Files In A Listbox From Filelist#
hey,
this is a question related to my thread http://www.vbforums.com/showthread.php?t=341772 ..... how do i add a checkbox stlye to my filelistcontrol? it can be done to the norma listbox but wat abt filelist?
and......
hw can i make it so that the contents of a listbox and filelistbox always remain the same when any change is made in filelistbox like PATH or PATTERN same thing shud appear in listbox
pls help!
Not Adding 2 Of The Same Items.....
How can i not add 2 of the same items in a list box for example if i already have "apple" and "orange" in that list the next thing i am going to type cannot be "apple" and "orange" if it is then it gives a massage box telling me u can't.... help plz
Add Explorer Style Rename Capability To ListView
Hello,
I have a problem using the LabelEdit on a ListView control because it seems that if you set the LabelEdit property to lvwAutomatic, the LabelEdit is activated on one click only instead of 2 low click. Some times ago, I had the same problem on a TreeView and I found an article in the MSDN that shows how to do it by using a Timer, and it works fine.
I tried to use the same code for my ListView but it does not work.
Thanks for your help...
Thierry Demoy
Adding Items Into A Combo Box With For/Next
Newbie problem, any help is greatly appreciated!!!
Here's what I have. I am writing a program that maintains reports for the volunteer firestation in my town. Each "User" of this program has their data stored in it's own file. (IE: If the UserID was 201 then their profile path is "App.path & "datauserinfo" & UserID & ".pfd"" making in my case the path: c:pauldenvfduserinfo201.pfd).
I am trying to use a for next loop (XasRadioLoads) to open these files one by one to get that data from them to fill in a combobox. I only have 2 users of a possible 20 configured at this point. What the loop is doing is adding 10 each of my 2 users filling up 20 spaces instead of just 2. Here is the code I am using.
---------------
On Error Resume Next
UserToVerify = 201
For XasRadioLoads = 1 To 20
Open App.Path & "datauserinfo" & UserToVerify & ".pfd" For Input As #1
Input #1, UserRadioID, UserLastName, UserFirstName, UserMI, UserAddress, UserCity, UserState, UserZIP, UserPhone, UserCellPager, UserGrantAccess, UserPassword
Close #1
combo_IC.AddItem UserRadioID & " - " & UserLastName & ", " & UserFirstName
combo_IC.Refresh
UserToVerify = UserToVerify + 1
Next XasRadioLoads
--------------------
Can anyone help me with this? THANKS A LOT!!!
Adding Items In A List Box
For class I'm writing a program in which I add prices to a list box with a button, then have a subtotal, sales tax and total. For some reason I can get the number I type to come up in the list and totals, but I can't figure out how to add all the items in the list. the labels for the subtotal, tax and total only change if I change the number. Here's my code:
Public Class Form1
Const Tax = 0.065
Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim Subtotal, SalesTax, Total, ST, ItemPrice As Double
ItemPrice = CDbl(txtItemPrice.Text)
lstSalesReceipt.Items.Add(txtItemPrice.Text)
Subtotal = ItemPrice + Subtotal
lblSubtotal.Text = FormatCurrency(Subtotal)
ST = (ItemPrice * Tax)
If chkTaxExempt.Checked = True Then ST = 0
SalesTax = ST + SalesTax
lblSalesTax.Text = FormatCurrency(SalesTax)
Total = Subtotal + SalesTax
lblTotal.Text = FormatCurrency(Total)
End Sub
End Class
|