Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Listview.ListCount Property Doesnt Exist?


Hi i have been trying If jobsectionlist.ListCount > 0 Then
but it doesnt work

i really need a quick way to check if the listview is empty or not

anyone know how?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Listcount Property
It appears as though the listcount property of a listbox is limited to an integer number. Is there a way to set the listcount property to return a longint value?

EFD

Its Like It Doesnt Exist!!!
So here i am made this tiny little program for an assignment thast due tomorrow.. and i tried to run it, and poof it wont run... im not saying theres an error (which their might be) but it wont run AT ALL.. i click the little play button and it brings up the macro tools, and asks me which macro i want to run... (normally itll run it automatically).. heres what i have..


Code:
Sub Ngrade(ByVal MT As Integer, ByVal FE As Integer)

Dim midterm As Integer
Dim final As Integer
Dim numgr As Integer
Dim row As Integer

Worksheets("Grades").Activate

row = 2

Do Until (IsEmpty(Cells(row, 9)))
MT = Cells(row, 8)
FE = Cells(row, 9)

midterm = (MT / 90) * 100
final = (FE / 100) * 100

numgr = (0.75 * final) + (0.25 * midterm)

Cells(row, 10) = Application.RoundUp(numgr, 0)

row = row + 1
Loop

End Sub

and it wont play at all... is it the macro, or soemthing to do with excel...

If File Doesnt Exist
when loading a file. say the file the person wants to load doesnt exist how do you make it
Code:
msgbox "there is no file by that name"
only if it doesnt exist

If Doesnt Exist Then Create
Is there a way I could make 2 arrays, One has Usernames(Var Userlist), The Second one has scores(Var Scorelist). Have it so if current username(Var Usern) doesnt exist in any array strings in array Userlist then create another string in array Userlist and have the new string's contents be Username and also know what spot in the array it is located and save the number for location in the array as Var userloc. if it does exist have it save the number for location of the name in the array as userloc.

Thanks

Table Or View Doesnt Exist
I am new to VB/ADO and oracle, and really need help. I am trying to get information from an oracle view and the error message says "ORA-00942 table or view does not exist." The view exists in the database, in SQL-PLUS data will appear, and a DESC will show all fields. What is wrong with this code or is something missing? Any reply is really appreciated. Thanks.


Private Sub Command1_Click()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command

With cn
.Provider = "OraOLEDB.oracle"
.ConnectionString = "data Source = vmprod;user id=name;password=passwd;"
.Open
End With
cmd.ActiveConnection = cn
cmd.CommandText = "select sorderid from view_sum_ordrqty"
cmd.CommandType = adCmdText
Set rs = cmd.Execute
While Not rs.EOF
MsgBox rs!sorderid
rs.MoveNext
Wend

rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub

**RESOLVED!!** Deleting Name From D/b That Doesnt Exist?
I have this form where if I type a persons name in I want to be able to press enter and if that name exists on the database recall all the info I have put in for them in the past.

I have the screen below already working to record data you put in but cant figure out how to get it to see info previously added..


Of course I will have a Check or Enter button.. but if someone can get it to auto seek then all the mroe better

This is the code I think I need to base it around... (hopefully)

Code:

Private Sub cmdEnter_Click()

gblA = DbOpen(db, ws)

sql = "SELECT * FROM [CoachingNotes] WHERE [Name] = " & """" & txtName.Text & """" & "

Set rs = db.OpenRecordset(sql, dbOpenDynaset)

  rs.MoveFirst
    Do While Not rs.EOF
        txtName.text.AddItem rs!Name
        txtprevious.text.additem rs!Notes
        rs.MoveNext
    Loop
End Sub


--------------------------------------------------------------------------------
I am a VB learner with huge ideas!! push yourself and you shall learn more

First Project: www.BowlAGE.co.uk (Forever GROWING!!)

I aim to assist the Ten Pin Bowling Instructors around the world with this!!!!
--------------------------------------------------------------------------------

Edited by - EPOS on 12/17/2004 3:06:33 AM

Application.run - Macro Doesnt Exist
Hi guys

I created a sub which opens new sheet and add code in it.
after that i run the macros inside the sheet and i get error which tells me the macro doesnt exist.
I also have application.run I added in the new macro I added.
If i close the form and open it again after the code was added it's works,
but if i want to run the macro after creating the code, it doesnt work.
anyone have idea???

Example of the code:
Private Sub AddWorksheetEvent(ByVal SheetName As String)
    Dim VBCodeMod As CodeModule
    Dim LineNum As Long

    Set VBCodeMod = ThisWorkbook.VBProject.VBComponents(SheetName).CodeModule
    With VBCodeMod
    LineNum = .CountOfLines + 1
    .InsertLines LineNum, _
    "refresh() & _
     application.run "a" b c d ...."
end with

application.run "sheet1.refresh"
end sub

The Frame Control Is Acting As If It Doesnt Exist
i have loaded the form which might explain

Control Array Element Doesnt Exist
Quote:





Run-time error '340':
Control array element '2' doesnt exist.






When I bring up the form to add the controls, I put in the number 1. the controls are on the form but are hidden, the index of these controls is set to zero. Can send a video of my steps if you like.

This is whats highlighted in my code... please advise....

VB Code:
Private Sub cmdOK_Click()    'numbers can only be inputted into the text field    'NumbersOnly is a Public Sub inside modTextBoxValidation    NumbersOnly txtNumber        'now add the amount of picture boxes    m_Images = Abs(txtNumber.Text)        With frmMain        For m_intAmount = 1 To m_Images            Set objUserControl = .Controls.Add("VB.PictureBox", "picImage" & m_intAmount)            'make sure that when the object is added, it does not go outside the picWorkArea area            'picWorkArea is then the objects "container"            Set objUserControl.Container = .picWorkArea        Next            'now make the control visible to the end user            [hl].picImage(m_intAmount).Visible = True[/hl]    End With        'now close me    Unload MeEnd Sub

What If A Registry Key Doesnt Exist - Error Handling - PLEASE HELP.
Hi All,
My little program to read in IP Address from registry is not working.


On Error GoTo IP2
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans000IPAddress")
IP2:
On Error GoTo IP3

If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans001IPAddress")
End If
IP3:
On Error GoTo IP4

If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans002IPAddress")
End If
IP4:
On Error GoTo IP5

If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans003IPAddress", "0")
End If
IP5:

These error handles dont work. Basically what I want is if ("HKLMSystemCurrentControlSetServicesClassNetTrans000IPAddress") doesnt exist then try ("HKLMSystemCurrentControlSetServicesClassNetTrans001IPAddress") and so on, but dont output an error.
Any ideas anybody?.

Error - Shared Memory Sql Server Doesnt Exist ............
Hi evryone

I have installed SQL server mixmode authorization.

After installing when i try to connect to database using sa account.

it gives error like Microsoft ODBC sql server driver - shared memory- sql server doesnt exist or access denied.

I unistalled sql server and again i installed. but same error facing.

Please reply.

Regards,

Program Crashes If Directory Doesnt Exist On Host Computer
ok question i have is this:

i have a program that checks a certain directory that can be set manually by the person useinga browse button...ok this works fine....

what i wanted to do was to make the program when it started to have a path already set in the text box to start....just to be user friendly....ok i got this to work fine also.....

where i ran into a problem was when i had someone beta test it for me when they went to hit the browse button it came up with a error saying path not found and it closed the whole program...we found out what it was was the main path i have set as default...becouse he doesnt have that path originally...so he created it himself and the program worked fine.....

what i want to know is is there a way that i can still have my program start with this default path but if they dont have it keep my program from showing a path error and letting them use the browse button to selct there own.....

im thinking its gonna be a error command but im not sure or if i have to use a "check to see if path exist on form load"

so any help on this thanks in advanced

Archive PPT-Save A Copy With Todays Date, If Doesnt Exist Already
I want to make a macro that will check a certain directory for a file with a filename like:

Presentation-20-09-2007.ppt

If the file for todays date doesnt exist, it saves the current presentaion with the proper date in the filename.

Is that possible?

Using The ScaleHeight Property Doesnt Work
hi all

im using a checkbox to enlarge a form.
for some reason the value of the scaleHeight is changing, but i dont see
the result in the runtime. the form stay in the same size. what am i doing wrong???

here is the code:


VB Code:
Private Sub Check1_Click()If Check1.Value = 1 ThenForm1.ScaleHeight = Form1.ScaleHeight + 200End IfEnd Sub

Property Exist?
Hello,

Does anyone know how to test the existence of a property for an object.


Something that would return a boolean like:

If Exist(objObj.property) then
msgbox "objObj property exists for this object"
else
msgbox "property doesn't exist"
end if

thanks

manu

Combobox Change Property Doesnt Work..
Would anyone know why the change property for a combobox wont work? If I place a forms 2.0 combobox into the form, it works fine. Is there a difference in how the forms 2.0 combobox works and the regular combobox?

Object Doesnt Support This Method Or Property
VB Code:
Option Explicit Private p As Printer Private Sub Command1_Click()    Dim str As String        str = "Testing 1 2 3"    [hl]p.Print str[/hl]    p.EndDocEnd Sub Private Sub Form_Load()    For Each p In Printers        If p.DeviceName = "CutePDF Writer" Then            Set Printer = p            Exit For        End If    NextEnd Sub

Object Doesnt Support This Property Or Method
I am currently getting an error on the highlighted line and cannot figure out why. Please advise.

The error is:

Quote:





object doesnt support this property or method





form code:

VB Code:
Private Sub Form_Load()    PageColorScheme MeEnd Sub


module code:

VB Code:
Option Explicit Public Sub PageColorScheme(frm As Form)    Dim strBC As String, strFC As String    Dim ctrl As Control        With frm        'background color, dark blue        strBC = RGB(104, 127, 217)        'foreground color, light blue        strFC = RGB(214, 223, 247)                'form background color        .BackColor = strBC                'control forecolors        For Each ctrl In .Controls            If TypeOf ctrl Is Shape Then                [hl].BorderColor = strFC[/hl]            End If        Next    End WithEnd Sub

Object Doesnt Support This Method Or Property
I want a function that makes all the textboxes,labels,comboboxes,list control, list view and date time picker controls locked
(I tried this code only for the textboxes and comobo boxes)
here is the code I tried
Code:
Public Sub GetControlNames(ByVal fname As Form)
' Get the names of ONLY labels,
' comboboxes, or textboxes
    Dim ctlCurrent As Control
    For Each ctlCurrent In fname.Controls
        If TypeOf ctlCurrent Is ComboBox Or _
           TypeOf ctlCurrent Is TextBox Then
               fname.ctlCurrent.name.Locked = True
        End If
    Next
End Sub


but gives error
"Object doesnt support this method or property.
Q1-- how to remove this error
Q2--- I 've also included the date time picker control but it says user defined datatype is not defined How to solve htis problem.

438: Object Doesnt Support This Property Or Method
I have a couple of classes here, one is a downlaoder, and the other is a download manager

the functionality is such that a downloader could operate without a download manager, but not the other way round. the user interacts with the downloader, and the manager is mostly silent, but emits events that the user can listen to if they wish. the two communicate using events;

an attempt to download when a download is already in progress, results in the url being passed to the download manager, which queues it. when the downloader emits a completed event, the manager will check its queue, and if there are remaining entries, they will be downloaded

each class hence has access to the other (im using class modules).. creating a new downloader causes the creation of a new manager. at the moment, im getting error 438 in the Class_initialize of the downloader.. it successfully does a:

Set dm = new DownloadManager 'dm is a Private dm as DownloadManager

the class_initialize for the Download Manager runs correctly.
once created, the manager is told who it's owner is, witha dm.setowner(me)
but instead of going to the SetOwner(ByRef owner as Downloader), the class_terminate of the manager is called (why?) and then the error is shown

any explanation?

MS Access: Event ItemChecked For ListView Doesnt Work
Hi!

I'm working with MS Access and VBA and have included a MS ListView Control into my form. When I add the following event to the class module

Private Sub ListView1_ItemCheck(ByVal Item As MSComctlLib.ListItem)
...
End Sub

the compiler says that the syntax of the event (parameters) is not correct. But in the object catalouge it's the syntax as above.
Does anyone know about this? I'm very grateful if you do.

Thanx,
kitty

ADODB.Command Doesnt Have "Output Stream" Property
I am trying to export query data from SQL Server in xml file.
I wanted to use ADODB.Streams with Command object:

.........................................
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cn

sXML = XML_HEADER
sXML = sXML & "<sql:query>"
sXML = sXML & sQuery
sXML = sXML & "</sql-query>"
sXML = sXML & XML_FOOTER

Set adoStreamQuery = New ADODB.Stream
adoStreamQuery.Open
adoStreamQuery.WriteText sXML, adWriteChar

Set cmd.CommandStream = adoStreamQuery

Set ResultStream = New ADODB.Stream
ResultStream.Open

cmd.Properties("Output Stream") = ResultStream
cmd.Execute , , adExecuteStream
sResult = ResultStream.ReadText
...

But my Command object doesn't have specified Dynamic Parameters, including "Output Stream".

Where did I go wrong?

Listview Item And Filesystem Objects, Does File Exist?
i have a listview with a list of directory paths... i.e C: emp, c:my junk

what i want to do is go through the listview and see if all the paths in the listview, if the folders exist... how can i do that? thanks...

i have this so far but a little stuck..
..............
Dim lvItem as ListItem
For Each lvItem In lvDir.ListItems
If objFSO.FolderExists(the lvitem's text) = True Then

-Gabe

Trapping For/in SQL Update To Determine Exist Or Not Exist Record
All,

Problem: I'm using a SQL Update command to update a username and password database (Access.) Update works on existing records and updates correctly. The problem is that the Update statement doesn't error out when the username doesn't exist. Basically, it doesn't do anything and doesn't give an indication that it failed to find the username specified.

Desired result : If username doesn't exist, I need to trap for that when performing the SQL Update procedure and let the user know that the password to be updated for that particular user is invalid since the username doesn't exist in the database.. Por ejemplo:...

.
Code:
Private Sub cmdUpdate_Click()

Dim PasswordConn As ADODB.Connection
Dim PasswordRecSet As ADODB.Recordset
Dim strUpdateuser As String
Dim strUpdatepass As String
Dim strUpdatenotes As String

Set PasswordConn = New ADODB.Connection
PasswordConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:programmingLBPP Password Utilitypasswordutility.mdb;"

PasswordConn.Open

strUpdateuser = txtUsername.Text
strUpdatepass = txtPassword.Text
strUpdatenotes = txtNotesPassword.Text

Dim SQL As String

SQL = "Update PasswordUtility SET fldPassword = '" & strUpdatepass & "', fldNotesPassword = '" & strUpdatenotes & "' WHERE fldName = '" & strUpdateuser & "';"

PasswordConn.Execute SQL

'If user name doesn't exist than tell the fool!!

PasswordConn.Close


End Sub

Listview Property?
is there a listview equivalent of a listbox's SelCount property

Listview: Key Property
I have problem setting the 'key' property for the listitems in a listview.

When I add/remove columnheader from a menu bar, I want to add/remove the corresponding listitems. Is there any way to do this other than setting the 'key' property? Please advice

I add the columnheader using
set clm = ListView1.ColumnHeaders.Add(, "key1",time Stamp")


when I add the listitems using
Do Until rs.EOF
If Not IsNull(rs!TimeStamp) then
set NewItem = ListView1.ListItems.Add(, "key1", rs!TimeStamp)
End If


It is not printing all the values. How do I set the key property for listitems?

thanks

Listview MultiSelect Property
I set the MultiSelect property of a Listview control to True
I want to do something else when the user select more then 1 file. how can i know how many files the user selected?

Listview LabelEdit Property
Sup,
I set the LabelEdit property of my Listview control to automatic, so when you click an item from the list you edit it.
The problem is that i can edit only the items under the first column.
How can i edit the items in other columns?

Listview Listitem TAG Property && .m3u
Hey, I'm planning on actually doing this right this time for compatibility. Can someone give me an example of how to use the Listview.listitem "tag" property? I'm wanting to do this so I can save playlists in my program as m3u. Also, I know these playlists are just text files, but how are they arranged? I want to be able to create playlists that are compatible with Winamp & Mediaplayer, as well as my program. I was using my own file extension and textfile pattern, but it was only compatible with my program. Sooo........ I'm wanting to go *.m3u. Any help is extremely appreciated.

ListView - Invalid Property Value
I'm new at using ListView. The following returns an Invalid Property Value message

Code:
.Item(1).SubItems(ColumnCounter + 1) = NewData(ColumnCounter)

What am I doing wrong?

Property Listview And Lvwreport
Why sometimes when I configure the property view of the listview for lvwreport (3), I don't get to activate the property checkbox for true, I don't sometimes get at least to see it.
In the company in that work had to use an API to place the checkbox.

How do I do the user to mark certain checkbox for when, him desmarcar all the other ones and to mark only that checkbox of that line?

ListView ? Property For 1 Colomn Only !?
Hi,

first I am coding in .net but may be somepeople in vb6 can tell me if there is a property in vb6 that exist for that and they removed it for .net, and just tell me what it is. May be it's teh same and I just don,t find it.

I have a list view, and the program populate it in sort that has many colums has he can enter in a line. But I don't like that at all.

I would like to only have 1 colomn only. If I remember correctly in vb6 you were able to change it with just a property name something like numberofrow =1 or something like that.

but I can't find anything related to it in vb.net !??

I want to use a list view cause everywhere in the program it's use a list view, soo I want to stay with that standart, I doN,t like to have many different things a little bit anywhere.

I checked out the Coloms (collection) property, but I can,t see what it do !

help me please !

How To Use Listview Checkbox Property?
i want to know how use the listview checkbox property?
and how to code it?




Edited by - say2x on 10/10/2005 2:05:16 AM

Listview ColumnHeader Property
Why don't I get the property 'Position' in ColumnHeader object
I'am using MSCOMCTL.OCX and Vb6 (sp6)

'*****
Private Sub Form_Load()

    Dim colx As ColumnHeader
    Dim colPos As ColumnHeader
    'Let the user reorder the columns
    ListView1.AllowColumnReorder = True
    
    'Set view to report
    ListView1.View = lvwReport
    
    'Add some columns
    Set colx = ListView1.ColumnHeaders.Add(, , "Col1")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col2")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col3")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col4")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col5")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col6")
        
    'Loop though each ColumnHeader object and set the
    'position of it dependent on what the user did
    'the last time
    For Each colx In ListView1.ColumnHeaders
        colx.Position = GetSetting(App.Title, "Settings", "Col" & colx.Index, colx.Index)
        colx.Width = GetSetting(App.Title, "Settings", "ColWidth" & colx.Index, colx.Width)
    Next
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim colx As ColumnHeader

    'Save the Position of each of the ColumnHeader
    'Objects so we can load them the next time
    'the user starts the program
    For Each colx In ListView1.ColumnHeaders
        SaveSetting App.Title, "Settings", "Col" & colx.Index, _
                    ListView1.ColumnHeaders(colx.Index).Position
        SaveSetting App.Title, "Settings", "ColWidth" & colx.Index, _
                    ListView1.ColumnHeaders(colx.Index).Width
    Next
End Sub
'**''
aeg

 

Listview Sorted Property
Greetings all:

I have an app that contains 3 listview controls. I want the items in each
list to be sorted, so at design-time I set the sorted property true,
sortorder ascending, sortkey 0. That seemed fine at first. However, VB
treats numbers in the listview as strings, which really hoses up a sorted
list. Given the following numbers, this is how they would sort.

2
31
32
35
4
788
790
8

and so on. Does anyone know a quick way around this, or must I either write
my own sort routine or abandon the idea of a sorted list all together. (Out of the last 2 options, I would have to
choose the latter; although experienced in other languages, I am new to VB).

Thanks,
Clark

Listcount 35K +
Well As You know the listcount method of a listbox won't work if the listbox have mor than 35000 items in it. So i just want to ask you guys if there is anyway to by pass this limitation. i mean count a listbox over 35000 items.

Listcount
With a ListBox, if there is nothing in it, will the ListCount be 0 or -1?

Listcount Or Something
I have a VB6 project that (once again) has somehow managed to outsmart me. There's 2 listboxes, a command button, and a file to output to. The user adds the files they want from one listbox to another, and from there, is put into the doomanf.cfg file with an a.Write statement. How do you automate how many lines of a.Write I will need!? Also, how do I also automate the Bsp0, Bsp1, Bsp2, ect... within the a.Write lines that are to be put into the doomanf.cfg. I tried incementing a counter & all that but nothing seems to work. CAN ANYONE HELP MEEEEE!!!!????

The code is as follows:


Code:

Dim GameType%
Dim Bsp$
Bsp0 = (List2.List(0))
Bsp0 = Bsp0 + 1
List2.List(0) = Str$(Bsp0)
ChDir (Spl1.Dir1.Path) & ("aseq3")
GameType = List1.ListIndex
MsgBox "writing to doomanf.cfg"
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("doomanf.cfg")
a.Write ("")
a.Write ("//This config file cycles through all the maps in the game. FFA mode.")
a.Write ("set g_gametype ") & (GameType)
a.Write ("set m1 ""fraglimit 10" & " ; map ") & (Left$(Bsp0, Len(Bsp0) - 4))
a.Write ("set m2 ""fraglimit 10" & " ; map ") & (Left$(Bsp1, Len(Bsp1) - 4))
' a.Write ("set m3 ""fraglimit 10" & " ; map ") & (Left$(bsp2, Len(bsp2) - 4))
' a.Write ("set m4 ""fraglimit 10" & " ; map ") & (Left$(bsp3, Len(bsp3) - 4))
a.Close

.ListCount Is Going Mad?
Hi everyone,

In my project I have a List box with values taken from a file ( F in the code ). It's simple:


Code:


Open F For Input As #2
Do Until EOF(2)
Input #2, a
List1.AddItem a
Loop
List1.ListIndex = 0
Close (2)



the problem is that when I define the variable maxc ( as long ) and equal to List1.ListCount I get either 0 or -1! ( It should be 180 )

Does anyone has any idea why?

Regards,

Kepler

Error 380 Using Listview Subitems Property
I am completely at a loss as to why this happens, but I have a small table that keeps track of reports. The information in this table is then displayed for the end-user, thus allowing them to choose a report from the list and view it. I filter by either unviewed reports only, or all reports. The problem is, when I try to list all unviewed reports, I get an error 380 "invalid Property value" when setting the subitems(i) = to something in the table. I can't say for sure, but it only seems to happen if the date viewed is empty. Even if I haven't got that far in the code!

Code:
Set rsReports = db.OpenRecordset(strSQL)
'Fill the listbox with the reports that have NOT been viewed
Do Until rsReports.EOF
If Not IsNull(rsReports![FILE]) Then
Set ItemX = lsvReports.ListItems.Add(, , rsReports![FILE])
If Not IsNull(rsReports![Date]) Then
ItemX.SubItems(conRptDate) = rsReports![Date]
Else
'The Date Should never be Null
ItemX.SubItems(conRptDate) = FileDateTime(ItemX)
End If
If Not IsNull(rsReports![Viewed]) Then ItemX.SubItems(conViewed) = rsReports![Viewed]
If Not IsNull(rsReports![From]) Then ItemX.SubItems(conSenderID) = rsReports![From]
If Not IsNull(rsReports![SORTDATE]) Then ItemX.SubItems(conRptSortDate) = rsReports![SORTDATE]
If Not IsNull(rsReports![SORTVIEW]) Then ItemX.SubItems(conRptSortViewed) = rsReports![SORTVIEW]
If Not IsNull(rsReports![BATCH]) Then ItemX.SubItems(conClaimsBatch) = rsReports![BATCH]
End If
rsReports.MoveNext
Loop
It crashes out when I try to assign the date (a non-empty field) I have tried other orders as well, and it does not matter which item is first. The conRptDate is a constant = 1 conViewed = 2 etc.
Thanks in advance for any help!

Property Question Of Listview Control
what property of the listview control disables the ability to edit names of the contents in the list?

ForeColor Property For ListView SubItems?
I have a ListView control in Report form. The list contains a list of hazards in our facility and several SubItems providing details of the Hazard. Each hazard can be listed as Minor, Moderate, or Severe. I want the entire row to be texted Red if the Hazard is Severe. Using the following code, I have gotten the Index to show up Red, but can't get any of the SubItems to go Red. Is there a way to do this?

Set NewItem = lvMain.ListItems.Add(, , adoRS("Index"))
.
.
.
NewItem.SubItems(4) = adoRS("Severity")
If adoRS("Severity") = "Severe" Then
NewItem.ForeColor = vbRed
End If

where adoRS is a RecordSet for the database containing the data and lvMain is the ListView control.

Thanks ahead of time for any and all assistance.

Listview - VerticalScrollBar Changes Col .Left Property
Hi VBcitizens,

I'm working with the .Left property of Columnheaders in a Listview,
I have a big amount of Columns wich enables the vertical scrollbar in it,

If I V-scroll further to the right columns then it seems the .Left property of the columns changes,
it threaths the .Left property starting from the left border of the "Listview window" itself,
not from the 1st column anymore, only the visible columns on the screen.

Is there a way how to get the 'absolute' .Left position starting from the 1st column?

This what i got so far wich worked smooth... until i had a V-scrollbar in the Listview and scrolled to the right.

Code:
Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Not ListView1.ListItems.Count = 0 Then

    Dim sCol As String
    Dim PosX As Single
        PosX = x

    Dim i As Integer
    For i = 1 To ListView1.ColumnHeaders.Count
        If PosX > ListView1.ColumnHeaders.Item(i).Left And _
           PosX < ListView1.ColumnHeaders.Item(i + 1).Left Then
           sCol = i
           Exit For
        End If
    Next i
    
    Dim NewVal As String
    NewVal = InputBox("Insert New Value :")
    
    If Not NewVal = "" Then
       If sCol = 1 Then
          ListView1.SelectedItem.Text = NewVal
       Else
          ListView1.SelectedItem.SubItems(sCol - 1) = NewVal
       End If
    End If
    
End If
End Sub


=============================================
aka Red2048.

Edited by - T48 - [RedPlanet] on 8/1/2004 11:43:25 AM

ListCount Limit???
I am using the following code with my form:

dim totfilecount as Long
totfilecount = File1.ListCount
I know totfilecount will be limited to 2,147,483,647

my question is : Is there a known limit to this listcount where there will be errors given , if so what is it? and is there a way to avoid this?
I will be working with very large numbers of files.

Thanks

List1.listcount
Hi there,
the code "list1.listcount" tells us the number of the items/lines in a listbox
What if we want to learn the number of items in a" textbox.." ?
what is the code?
thanks

ListCount Problem
I want the listcount to start 1 instead of 0. I got 275 or 276 items in my listbox and as I add each item to it I want it to add up.

I tried this:

Code:
Private Sub AddTech_Click()
Dim i(1 to 276) as integer
txtlevel = list2.listcount(i)
end Sub

But it failed horribly any ideas?

Using Listcount For More Than 1 Item
The problem is i have a multi select listbox and i wondered whether it was possible to tell how many items were selected using listcount?

my code for selecting 1 items is...

For q = 3 To List1.ListCount - 1
If List1.Selected(q) = True Then
Label50.Caption = Label50.Caption - 5
Exit For
End If
Next q
End Sub

how can i adapt this?

ListCount/ListIndex
Quote:




Quote:
Originally Posted by herilane
Add an If that checks whether you're past the last item in the listbox (the ListCount property should be of help there).





Code:
'UPDATE COMBOBOX WITH CURRENT VALUE
'If the user moves past the last record of the database
'then display "<New Record>" in the combobox while the record
'is being added. Otherwise display the value corresponding to
'the current record being displayed.

If Range("database").Rows.Count - 1 = ComboBoxStoreSelect.ListCount _
Then ComboBoxStoreSelect.ListIndex = txtRow.Value - 1 _
Else: ComboBoxStoreSelect.Value = "<New Record>"



Can anyone tell me why this isn't working right? I works fine until you advance past the last record... then KaPut! I get an error saying "Could not set the ListIndex property. Invalid property value."

Any ideas?

List1.ListCount && Where?
Hello all. In the following code where would I place code to make label1.caption list1.listcount? And what is the best line because I use:
Label1.Caption = "Item's: " & List1.ListCount and it does not work sometimes. So is there any other way if so where or if not where in this code would i place it?:

Code:
On Error GoTo 1
With CommonDialog1
.DialogTitle = "Open Proxy List"
.Filter = "Text File|*.txt"
.ShowOpen
Dim sText As String
Dim X As Integer
X = FreeFile
On Error Resume Next
Open .FileName For Input As #X
While Not EOF(X)
Input #X, sText$
If sText$ = "" Then
Exit Sub
Else
List1.AddItem sText$
DoEvents
End If

Wend
Close #X

End With

Exit Sub
1
Exit Sub
So I just need to know the best way to get label1 list1.listcount and where exactly I would place it to work correctly and display it when it is done loading. Thanks very much in advance guys and all the help is so much greatly appreciated so thanks and have a good day. Bye bye all.

Copyright © 2005-08 www.BigResource.com, All rights reserved