0

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

5
Contributors
8
Replies
41
Views
2 Years
Discussion Span
Last Post by cgeier
Featured Replies
  • 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") Read More

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

  • Got it! Thanks group! Don Read More

1
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")
0

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

0

@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.
0

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

0

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

1

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

Edited by Minimalist

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.