Group,

I've published my first VB.net program (woo hoo!). This prompts me to ask a couple of questions:

1) I'm using a couple of text files to hold some user updated info. Is there a way to have the setup program to create the folder and attached the text files in it (FYI.... I need the files save to the users "C" drive in a folder called "Restran Conversion")?

2) I've added a self created icon to the forms property. When the program is opened, this icon isn't display as it should in the task manager. It displays as a default "floppy disk". Have I done something incorrectly? Should I have included the icons within the program file somewhere?

As always, Thanks for your help!

Don

If Not System.IO.File.Exists("C:\Restran Conversion\somefile.txt") = True Then
    Dim file As System.IO.FileStream
    file = System.IO.File.Create("C:\Restran Conversion\somefile.txt")
    file.Close()
End If
My.Computer.FileSystem.WriteAllText("C:\Restran Conversion\somefile.txt", "Some text")

As far as icon not displaying correctly i am sure i had same problem once .I had changed something in Property window and problem got soloved.I will try to solove it i am opening vb

@imti321:
You have forgotten to pass argument value for append As Boolean in your last line

My.Computer.FileSystem.WriteAllText("C:\Restran Conversion\somefile.txt", "Some text")

and it can raise an exception.
The codes should be

If Not System.IO.File.Exists("C:\Restran Conversion\somefile.txt") Then
   System.IO.File.Create("C:\Restran Conversion\somefile.txt")
End If
My.Computer.FileSystem.WriteAllText("C:\Restran Conversion\somefile.txt", "Some text", False)
  1. At run time the form does not show its Icon if its ControlBox property sets to False or its showIcon property sets to False.

@Shark1 yes my apologies but what instead of False we write True their.Because False will overwrite the existing content.

If the append parameter is True, the method appends the text to the file; otherwise existing text in the file is overwritten.

Go to Solution Explorer--- Double click on MyProject----Goto Application and where it says Icon ---- select your own Icon.

Got it! Thanks group!

Don

commented: Welcome!! +2

You really should put your folder in %ProgramData% (or in one of the other Windows folders designated for user data).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.