Newbie Question...

jrsteensen

New member
Joined
Oct 8, 2005
Messages
2
Programming Experience
Beginner
Display Chatlogs from a game that are stored locally

Hello all. I am trying to learn VB.NET in my very limited spare time, (A soldier's work hours SUCK.) and am working on my first program. I want it to display Chatlogs from a game that are stored locally. It needs to go to the right directory. (the default is: C:/Program Files/CCP/EVE/capture <-- This needs to be user configurable.) (The Chatlogs are located at: \%pathtocapturefolder%\capture\Chatlogs from that configurable path.)

Then take the file name, (example filename: BWS_20051003_175422.txt, which is ChannelName_4 digit year 2 digit month 2 digit day_2 digit hour 2 digit minute 2 digit second.txt) and show all the ones in a folder in a scrollable list to the left of the form with the output formated like this: BWS 03/10/2005 1754:22, (sorted by Channel name, Date, and Time.)

On the right the contents of the clicked name on the left, shown as read only in a scrollable text box. (With only a copy function when right-clicked.)

Thanks for the help. I've puzzled over how to do this all day, and just can't seem to get started. I've scoured for snippets, but can't seem to find them.
 
Last edited by a moderator:
i would put a textbox on the top left side of the form in which the user can type in the directory that the files are in with a button next to it, to the right with "..." as the text and when the user clicks on it a FolderBrowserDialog is opened so they can use that to locate the folder

anywho then i'd have a listbox below the textbox that will actually list the files (formatted like you've shown, of course)

and a button below that titled "List Files" or whatever -> this button when clicked will actually list the files

to list the files you could use the System.IO.Directory.GetFiles function to get the files from the directory in the textbox above the listbox

then just go through the array and check each element to see if it's extension is .txt and if it is then add it to the listbox

for adding it to the listbox use the Listbox1.Items.Add method to add the text in the format you want it displayed you should also add the actual filepath to the text file in the item's SelectedValue as well so when the user clicks a file from the listbox you can use the SelectedValue to actually open and display the file contents

ok, i know this is very general and if you need help with some of the actual coding, feel free to ask

welcome to the forums :)
 
Ive got a form that gets the base path, but Im not sure how to save the results to a variable that will pass between forms.

So then what this listbox needs to do, is take that variable, and append a "/chatlogs/" on the end, and then list the file names. Im really not sure how to format/filter them either.

On my main form I have the following: ListBox2, TextBox2, and Button1.

If you wouldnt mind showing me the code if its simple enough for you. Here is some sample filenames, and desired output:

Input:

BWS_20051003_175422.txt
BWS_20051007_101503.txt
BWS_20051009_224203.txt
Corp_20051002_172654.txt
Local_20051003_204430.txt
Private_Chat_(Yoseph_Cohen)_20051006_161203.txt

Output:

BWS:
03OCT2005 17:54:22
07OCT2005 10:15:03
09OCT2005 22:42:03

Corp:
02OCT2005 17:26:54

Local:
03OCT2005 20:44:30

Private Chat (Yoseph Cohen):
06OCT2005 16:12:03
 
the easiest way for you to pass the directory from the search form to the main form would be to add a module to the project and put:

Friend gstrDirectory As String

by declaring it as Friend it means that every form in your application can access it

so in your search form when you've got the folder path simply set that global variable to it:

gstrDirectory = "your path" & "\chatlogs\"

note that i'm also appending the chatlogs folder here as well so we dont have to add it later

to get the files to handle:
Dim strFullFile As String 'Hold origial full path
Dim strModifiedFile As String 'Holds formatted info
Dim strFiles() As String = System.IO.Directory.GetFiles(gstrDirectory)
'This makes a string array (strfiles) and each array element contains the entire path as well as the name and extention of each file
For Each StrFullFile In Files()
'here's where the file name is formatted for display in the listbox

Next strFullFile

that's as far as i had time to get to today, though i am realising that using the SelectedValue of the listbox may not be possible, but since i do notice that you've got the output sectioned (bws, corp, local, etc) a treeview would be much more approperate, and treeview nodes do have a tag property that we can store the full path of the file in

i'll get back to this within a couple of days, post any other questions you may have in the meantime
 
Back
Top