Click here to Skip to main content
15,905,874 members
Home / Discussions / C#
   

C#

 
GeneralRe: File creation and naming increment Pin
EliottA21-Jan-09 5:12
EliottA21-Jan-09 5:12 
GeneralRe: File creation and naming increment Pin
musefan21-Jan-09 5:15
musefan21-Jan-09 5:15 
AnswerRe: File creation and naming increment Pin
PIEBALDconsult21-Jan-09 5:20
mvePIEBALDconsult21-Jan-09 5:20 
AnswerRe: File creation and naming increment Pin
Tom Deketelaere21-Jan-09 5:31
professionalTom Deketelaere21-Jan-09 5:31 
AnswerRe: File creation and naming increment Pin
User 665821-Jan-09 5:45
User 665821-Jan-09 5:45 
AnswerRe: File creation and naming increment [modified] Pin
Luc Pattyn21-Jan-09 5:56
sitebuilderLuc Pattyn21-Jan-09 5:56 
GeneralRe: File creation and naming increment Pin
User 665821-Jan-09 7:17
User 665821-Jan-09 7:17 
GeneralRe: File creation and naming increment Pin
Terick21-Jan-09 6:16
Terick21-Jan-09 6:16 
Thank you all for your posts. It's been helpful. I'm still a little stuck, but I have the general idea.

The files may get deleted, so I will need to take that into account. Also, I'm not using any database and for this application wont be using one.

This is what I have so far. Please let me know if there are better methods:

public void filecount(string file)
{
int x;
int y;
string file;

int filepaths = Directory.GetFiles(@"C:\Desktop\Request", "*txt").Length;
x = filepaths +1;

StreamWriter sw;
sw = File.CreateText(@"C:\Desktop\Request\Text" +y +".txt");
file = Path.GetFileName(@"C:\Desktop\Request\Text" +y +".txt").ToString;
sw.Close();

return file;
}

public void btn_Click(object sender, EventArgs e)
{
filecount(file);
}

Thanks again for helping a newbie out!
GeneralRe: File creation and naming increment Pin
User 665821-Jan-09 7:29
User 665821-Jan-09 7:29 
GeneralRe: File creation and naming increment Pin
riced22-Jan-09 4:28
riced22-Jan-09 4:28 
AnswerThis post is not addressing your question but ... Pin
Ennis Ray Lynch, Jr.21-Jan-09 6:04
Ennis Ray Lynch, Jr.21-Jan-09 6:04 
GeneralRe: This post is not addressing your question but ... Pin
Terick21-Jan-09 6:26
Terick21-Jan-09 6:26 
GeneralRe: This post is not addressing your question but ... Pin
Ennis Ray Lynch, Jr.21-Jan-09 6:30
Ennis Ray Lynch, Jr.21-Jan-09 6:30 
GeneralRe: This post is not addressing your question but ... Pin
PIEBALDconsult21-Jan-09 7:54
mvePIEBALDconsult21-Jan-09 7:54 
GeneralRe: This post is not addressing your question but ... Pin
Ennis Ray Lynch, Jr.21-Jan-09 8:28
Ennis Ray Lynch, Jr.21-Jan-09 8:28 
GeneralRe: This post is not addressing your question but ... Pin
PIEBALDconsult21-Jan-09 8:31
mvePIEBALDconsult21-Jan-09 8:31 
GeneralRe: This post is not addressing your question but ... Pin
Ennis Ray Lynch, Jr.21-Jan-09 8:34
Ennis Ray Lynch, Jr.21-Jan-09 8:34 
GeneralRe: This post is not addressing your question but ... Pin
PIEBALDconsult21-Jan-09 8:37
mvePIEBALDconsult21-Jan-09 8:37 
GeneralRe: This post is not addressing your question but ... Pin
Ennis Ray Lynch, Jr.21-Jan-09 8:38
Ennis Ray Lynch, Jr.21-Jan-09 8:38 
GeneralRe: This post is not addressing your question but ... Pin
Terick21-Jan-09 9:44
Terick21-Jan-09 9:44 
GeneralRe: This post is not addressing your question but ... Pin
PIEBALDconsult21-Jan-09 11:18
mvePIEBALDconsult21-Jan-09 11:18 
GeneralRe: This post is not addressing your question but ... Pin
Ennis Ray Lynch, Jr.21-Jan-09 9:48
Ennis Ray Lynch, Jr.21-Jan-09 9:48 
QuestionReference syntax Pin
kanchoette21-Jan-09 4:13
kanchoette21-Jan-09 4:13 
AnswerRe: Reference syntax Pin
Eddy Vluggen21-Jan-09 4:46
professionalEddy Vluggen21-Jan-09 4:46 
GeneralRe: Reference syntax Pin
kanchoette21-Jan-09 21:30
kanchoette21-Jan-09 21:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.