Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 5th, 2006, 5:54 PM   #1
PrarieCat
Newbie
 
Join Date: Jan 2006
Posts: 1
Rep Power: 0 PrarieCat is on a distinguished road
Question Assist in using cdl to add long file name to listbox -VB6

Making a long story short(er)-

-Hired "Programmer" to author my program; found "finished product" terribly flawed & as usual....I jumped right in determined to learn & repair "on the fly".

-Actually done quite well up to now, BUT getting frustrated that the last instance in function left to repair has me baffled when it's likely the simplest.

Problem as follows:
Objective was to have user able to add/delete/ and hopefully rearrange order of list of user-selected file-names. (Exactly like using an MP3 player; creating list of music files to play, and able to individually select from list to move up/down or remove from list.)

Programmer used MSFlexgrid(Not MSH), and was only able to add singly, or delete entire list. Finding no encouraging info of flexgrid being that "flexible", I'm testing use of listbox instead. From the debugging/error info, I think my only fault is within this segment: command button to "Add an Item". Program runs, allows Show and Select of a file, but clicking Open in cdl does not add file's name (as a path, c:/program files/my app/picks/...) to the list, but returns warning message that "No file was selected."

I'm a quick study of most anything I take on, and picked up enough "general" VB method in the last 10 days to see that it's actually a very simplistic language in & of itself, so naturally that's when it jumps up to bite me in the application & take things down a bit.

Code below has a fair number of extra calls not needed, as I last began trying various string bits copied here & there. Original Sub, using flexgrid, is listed below divider in case it may help. Not tied to any particular form, here; if I really could selectively delete/move entries in flexgrid I'm all for it, or any other data form better suited to my needs.

Any pointers would be greatly appreciated; think I've been too close for too long, almost non-stop 10 days, and combined with that mid-40's "erratic near-focus-almost time for bifocals-thing", the answers likely right in front of me but blurry.

Thanx!
David


========================================================
Private Sub btn_Add_X_Click()
Dim int_Number_Of_Xs As Integer
Dim str_X_Name As String
Dim str_Skip As String
Dim str_File_Name As String
Dim i As Integer
Dim f As Integer

Let cdl_Xs.FileName = ""
cdl_Xs.ShowOpen
Let str_X_Name = cdl_Xs.FileName
If Len(str_File_Name) = 0 Then
MsgBox Title:="Warning", _
Prompt:="No X was selected.", _
Buttons:=vbExclamation + vbOKOnly
Else
With lst_Xs
Let .Text = str_File_Name
If .Selected(0) = True Then
lst_Xs.AddItem ("")

End If
End With
End If
f = FreeFile

Let m_boo_Run_Defined = True
End Sub

===================================
====original sub used with MSFlexgrid below====
Private Sub btn_Add_X_Click()
Dim lng_File_Handle As Long
Dim str_File_Name As String
Dim str_Temp As String
Dim i As Integer

Let cdl_Xs.FileName = ""
cdl_Xs.ShowOpen
Let str_File_Name = cdl_Xs.FileName
If Len(str_File_Name) = 0 Then
MsgBox Title:="Warning", _
Prompt:="No X was selected.", _
Buttons:=vbExclamation + vbOKOnly
Else
Let m_int_No_Of_Xs = m_int_No_Of_Xs + 1
With grd_List_Of_Xs
Let .Row = m_int_No_Of_Xs
Let .Col = 0
Let .Text = str_File_Name
End With
Let m_boo_Run_Defined = True
End If
End Sub
PrarieCat is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:44 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC