Jump to content
Xtreme .Net Talk

Audax321

Avatar/Signature
  • Posts

    90
  • Joined

  • Last visited

Everything posted by Audax321

  1. LOL... well I mean have both functionality so you could use either... the code to read/write a simple ini file is so long now...
  2. Okay, it turns out the error was caused by another line later on that was running because the program was failing to remove the invalid folder. To fix this.. I changed the type of loop from a FOR loop to a DO WHILE loop: If (MenuItem11.Checked = True) Then inti = 0 Do While inti <= lstSelDir.Items.Count - 1 If (System.IO.Directory.Exists(lstSelDir.Items.Item(inti)) = False) Then lstSelDir.Items.RemoveAt(inti) inti = inti - 1 End If inti = inti + 1 Loop End If This seems to have done the trick... Thanks... :)
  3. Ok, now I'm confused... I tried making another project and tried a string variable and actual "C:\" text ... and guess what .. it worked! But, that doesn't really help me. All of the paths that I need to check are contained in a listbox.. here is the actual code from my application... If (MenuItem11.Checked = True) Then For inti = 0 To lstSelDir.Items.Count - 1 If (System.IO.Directory.Exists(lstSelDir.Items.Item(inti)) = False) Then lstSelDir.Items.RemoveAt(inti) inti = inti - 1 End If Next inti End If I don't understand why it won't work with the listbox.items.item(inti) displaying the path because it returns the path as a string I believe. Even setting the path I get from the listbox to a string variable and then checking the variable does not help any... :(
  4. rrrrrrgh.. that is so odd.. I even made a new project with just that code in it to make sure nothing else was conflicting and it still didn't work. Its fine as long as the directory exists. But if I delete the directory and then the program checks to see if it exists when it doesn't it gives me an error if I'm running the app from VB or causes the program to hang if I'm running it from outside VB. I even checked the VB help section .. and they say that it returns either True or False, but its doing something queer in my program. You wouldn't mind posting your code so I can try it in my program would you?? I think my VB is retarded... :)
  5. Okay, I have this code... If(system.io.directory.exists(path) = True) THen 'do some crap End if Pretty straight forward, right? It's fine when the IF statement is TRUE. If, however, the directory doesn't exist, instead of just quietly skipping the code, it decides to give me an error and crash like a spoiled brat.... Anyone know, how to fix this? Thanks.. :D
  6. I hope this code will help someone else: It just loops through the subdirectories as BillSoo said above.. I'm just pasting all of the code from my form... Dim strSubDir As String() Dim strSub As String Dim inti As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click lstseldir.Items.Add("C:\MP3s") inti = 0 Do While inti <= lstseldir.Items.Count - 1 If (System.IO.Directory.Exists(lstseldir.Items.Item(inti)) = True) Then strSubDir = System.IO.Directory.GetDirectories(lstseldir.Items.Item(inti)) For Each strSub In strSubDir If (strSub <> "") Then lstseldir.Items.Add(strSub) End If Next strSub End If inti = inti + 1 Loop End Sub
  7. ahhh, i understand now.. ya, that should work very well... thanks! :)
  8. Thats the same thing I was thinking, but how would you tell the loop to stop. Because different directories can have different numbers of subdirectories... So wouldn't it keep looping and looping trying to find more subdirectories...?
  9. Okay I have my program finding subdirectories like this: Dim subdir as string() Dim addsub as string Dim targetdirectory subdir = system.io.directory.getdirectories(targetdirectory) For each addsub in subdir lstdir.items.add(addsub) Next addsub The problem with this code is that it only retrieves subdirectoris one level deep. Is there any way to retrieve all subdirectories. For example... enter C:\MP3 for target directory returns: C:\MP3 C:\MP3\MP3CD1 C:\MP3\MP3CD1\GoodMP3s C:\MP3\MP3CD1\GoodMP3s\MaybeTheseMP3sAreJunk and so on and so on... basically goes as deep as possible to retrieve all subdirectories in the main directory that was initially selected... Thanks... :) And still, if someone could explain file input and output in VB.NET, I would really appreciate it... its confusing..
  10. I'm completely lost... it was so easy in VB6 to read and write files. Couldn't they just leave that functionality as it was :( All I want to do is write to settings.ini (in installation folder where my app is) to save settings. And then load the settings from settings.ini when the program runs... Also is there anyway to bring a window to the front by clicking on the notification icon...NEVER MIND THIS QUESTION.. I FIGURED IT OUT!! :)
  11. So, what your saying is that this app I am planning on converting to .NET (launches a game and waits for it to exit so it can do some stuff) will give the game more memory if it requires it? Say a user is playing the game and desperately needs an extra 4 mb. Will .NET scale its memory consumption down accordingly? I guess I'll give .NET a try and see how it goes. It definitely owns the hell out of apps that you don't need to worry about hogging memory from another more memory intensive app. Thanks.. :)
  12. Okay, How does application deployment work in .NET. In VB6 you had a nice MAKE .exe command. What do you have to do in VB.NET to create this file. The .exe in the bin folder doesn't show the icon that I have selected for my form. It just has an ugly white square. Also, how do you go about creating the .msi file for setup? Thanks... :)
  13. ... .NET memory usage for a simple form with four buttons and two listboxes uses about 16 mb of memory!!!! I was thinking about making a program in .NET to run a game.. but damn thats going to hog memory the game could be using, seriously killing any interest in the app... guess I'll stick to VB6 for any "practical" programming I need it for. Is there anything that can be done to reduce the consumption?
  14. Okay, I understand VB.net coding pretty well. But, I am stuck... I decided to make a search program for my first .NET program. There are two things I am stuck doing... 1. Trying to open a Browse for Folder window: Module BrowseFolder 'Open Folder Private Const BIF_RETURNONLYFSDIRS = 1 Private Const BIF_DONTGOBELOWDOMAIN = 2 Private Const MAX_PATH = 260 Private Structure BrowseInfo Dim hwndOwner As IntPtr Dim pIDLRoot As Long Dim pszDisplayName As Long Dim lpszTitle As Long Dim ulFlags As Long Dim lpfnCallback As Long Dim lParam As Long Dim iImage As Long End Structure Private Declare Function SHBrowseForFolder Lib "shell32" (ByVal lpbi As BrowseInfo) As Long Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long Public Function OpenDirectoryTV(ByVal odtvOwner As Form, ByVal odtvTitle As String) As String Dim lpIDList As Long Dim sBuffer As String Dim szTitle As String Dim tBrowseInfo As BrowseInfo szTitle = odtvTitle With tBrowseInfo .hwndOwner = odtvOwner.Handle .lpszTitle = lstrcat(szTitle, "") .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN End With lpIDList = SHBrowseForFolder(tBrowseInfo) If (lpIDList) Then sBuffer = Space(MAX_PATH) SHGetPathFromIDList(lpIDList, sBuffer) sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1) OpenDirectoryTV = sBuffer End If End Function End Module The program gets stuck at "lpIDList = SHBrowseForFolder(tBrowseInfo)" but I have absolutely no clue why... 2. VB6 had the file list box that you could use to loads files from a directory into. Is there a similiar control or method to do this in Vb.net. Keeping in mind that the program I am trying to make has to filter files according to their extension.... like search just .mp3 file or search just .mp3 and .mpg files, etc... Thanks.. :)
×
×
  • Create New...