School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
You're Browsing As A Guest! Register Now...
Become an Expert!

Join 357,971 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,548 people online right now.Registration is fast and FREE... Join Now!



Favourites Application (URGENT HELP NEEDED)

52 Weeks of Code Challenge:Android

Week #11 of the 52 Weeks of Code Challenge is Android, you should give it a shot. Click Here!
Page 1 of 1

Favourites Application (URGENT HELP NEEDED) I have a favourites application which makes files corresponding with t Rate Topic: -----

#1 Jack Eagles1  Icon User is online

  • D.I.C Regular
  • Icon

Reputation: 11
  • Posts: 380
  • Joined: 10-December 08


Dream Kudos: 50

Posted 07 April 2009 - 07:48 AM

Hi,


I have a favourites application which makes files corresponding with the favourites, but with the windows filesystem, I cannot create files with the charactors: <> /\ : ? * ". This means that I cannot create favourites with HTTP:// in them, which kind of ruins the point of having a favourites viewer :D.

Does anyone have an Idea how I could convert the http:// to another expression and save it, and then when the project loads make it into http:// again. I have thought about using Regex to replace the expressions, but I do not know how to do that in a listbox

Here is my code:

Imports System.IO
Public Class Form1
	Dim info As IO.FileInfo
	Private Function MakeFave()
<<<<<<<<<<< Code to convert the http:// into the expression for the HTTP:// (say http&&%)	  
   Try
			If TextBoxX1.Text = "" Then
				MsgBox("You cannot create a Favourite with no name!", MsgBoxStyle.Information, "Error")
			Else
				MkDir("C:\Netbrowser\Favourites\" + TextBoxX1.Text)
				MsgBox("Favourite Created", MsgBoxStyle.Information, "Done")
				TextBoxX1.Text = ""
			End If
		Catch ex As Exception
			MsgBox("Error, check that you haven't allready made this favourite", MsgBoxStyle.Information, "EEK! An Error!")
		End Try
		ListBox1.Items.Clear()
		GetFaves()
	End Function


	Private Function GetFaves()
		Dim di As New DirectoryInfo("C:\Netbrowser\Favourites")
		For Each subdi As DirectoryInfo In di.GetDirectories
			ListBox1.Items.Add(subdi.Name)
		Next
<<<<<<<<<<< Code to convert the expression for the HTTP:// (Say http&&%) into the HTTP:// 
	End Function


	Private Function DeleteFaves()
		Try
			If ListBox1.SelectedItem = Nothing Then
				MsgBox("No favourite specified", MsgBoxStyle.Information, "Error")
			Else
				My.Computer.FileSystem.DeleteDirectory("C:\Netbrowser\Favourites\" + ListBox1.SelectedItem, FileIO.DeleteDirectoryOption.DeleteAllContents)
				MsgBox("Favourite Deleted", MsgBoxStyle.Information, "Done")
			End If
		Catch ex As Exception
			MsgBox("Error in deletion", MsgBoxStyle.Information, "EEK! An Error!")
		End Try
		ListBox1.Items.Clear()
		GetFaves()
	End Function


	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		GetFaves()
	End Sub


	Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
		MakeFave()
	End Sub


	Private Sub ButtonX2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX2.Click
		DeleteFaves()
	End Sub


	Private Sub ButtonX3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX3.Click
		ListBox1.Items.Clear()
		GetFaves()
		MsgBox("List refreshed", MsgBoxStyle.Information, "Done")
	End Sub


End Class





Thanks in advance for any help :)

This post has been edited by Jack Eagles1: 07 April 2009 - 12:01 PM

Was This Post Helpful? 0
  • +
  • -


#2 Jack Eagles1  Icon User is online

  • D.I.C Regular
  • Icon

Reputation: 11
  • Posts: 380
  • Joined: 10-December 08


Dream Kudos: 50

Re: Favourites Application (URGENT HELP NEEDED)

Posted 07 April 2009 - 08:10 AM

Oh and I cant use my.settings
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month