Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[question] help in C# please
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 8:10 am    Post subject: [question] help in C# please Reply with quote

i'm working at WindowApplication and i wanna create a button for saving.. is there option that allows me to do it??
_________________
Stylo
Back to top
View user's profile Send private message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Tue Dec 18, 2007 8:18 am    Post subject: Reply with quote

A button to save What?
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 8:28 am    Post subject: Reply with quote

i'v created textbox to write some things in it and i wanna create a saving button to save what's write inside that textbox
_________________
Stylo
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Tue Dec 18, 2007 8:33 am    Post subject: Reply with quote

SaveDialog SD = new SaveDialog();
SaveDialog.ShowDialog();
If I remember correctly.
or it might be SaveFileDialog...
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 8:51 am    Post subject: Reply with quote

thx symbol but how do i tell him to save a specific info from my TextBox to a File??? and when i try to save the area of file type is empty ( i mean the place with *.txt / All files place) what do i need to do to see it?
_________________
Stylo
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Tue Dec 18, 2007 8:54 am    Post subject: Reply with quote

System.IO.File.WriteAllText("FileName.txt",textBox1.text + " " + textBox2.Text);

if you want a new line then use System.IO.Stream if I'm not wrong.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 8:57 am    Post subject: Reply with quote

the File.WriteAllText .... is wrong no such thing in File. :\ anything else? Confused
_________________
Stylo
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Tue Dec 18, 2007 9:12 am    Post subject: Reply with quote

You need System.IO...
But I wouldn't add the whol libary just for that, when you write System.IO.File it uses only the parts needed to use it.
Since I don't have C# here, I'll google some and see if I was right.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 9:16 am    Post subject: Reply with quote

i'm using System.IO for other things ofcours so i dont mind to use it...
_________________
Stylo
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Tue Dec 18, 2007 9:38 am    Post subject: Reply with quote

System.IO.File.WriteAllText() works fine...
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 10:22 am    Post subject: Reply with quote

it's says 'System.IO.File' does not contain a definition for 'WriteAllText'
and when i wanna save file it open the save dialog and i cant choose file name cuz nothing is inside there how can i input values inside??
look picture..



choose.JPG
 Description:
aa
 Filesize:  28.65 KB
 Viewed:  8770 Time(s)

choose.JPG



_________________
Stylo
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Tue Dec 18, 2007 10:33 am    Post subject: Reply with quote

Add extention... you can also add the control from the tool box, go to dialogs and drag Save Dialog to your form, but I prefer doing it the other way with a code.
I think its BlBla.filter = "Executeable files (*.exe) bla bla text lol Very Happy|*.exe|text lol|*.extention";
BlaBla is the name of the SaveFileDialog.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 10:43 am    Post subject: Reply with quote

ok that worked perfectly but i have another problem
look picture..
see the big TextBox..
i wanna write something inside it and when i click save it will open dialog and bla bla... and it will save what i'v writen inside that big TextBox as *.txt / *.exe / or whatever..



asd.JPG
 Description:
aasd
 Filesize:  14.06 KB
 Viewed:  8765 Time(s)

asd.JPG



_________________
Stylo
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Tue Dec 18, 2007 12:45 pm    Post subject: Reply with quote

Code:

private void Save_Click(object sender, EventArgs e) //Save would be the button name
{
    SaveFileDialog sfd = new SaveFileDialog();
    sfd.DefaultExt = "txt";
    sfd.AddExtension = true;
    sfd.FileName = FileName.Text; //Assuming FileName is the name of the textbox with that says "file name here" or whatever
     sfd.FileOk += new CancelEventHandler(sfd_FileOk);
     sfd.Show();
}

private void sfd_FileOk(object sender, CancelEventArgs e)
{
     SaveFileDialog sfd = (SaveFileDialog)sender;
     string Path = sfd.FileName.Substring(sfd.FileName.LastIndexOf("\\")+1);
     File.WriteAllText(Path, Code.Text); //Assuming that Code is the name of the textbox that has the stuff to be saved in it
}

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 18, 2007 2:03 pm    Post subject: Reply with quote

i still got problem with the line File.WriteAllText it says 'System.IO.File' does not contain a definition for 'WriteAllText'
and i'm using System.IO

_________________
Stylo
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites