Page 1 of 1
[Solved!]New save format?
Posted: Fri Dec 02, 2011 12:07 am
by Frozen
Well I have been working on many programs for Minecraft and mods, but today is not the time to talk about it.
I'm looking for some help making a program which opens a new format like the ones after the name of something EX. .png .txt .java etc.
I want the program to open a file .mmg format and then showing up the text on a richtextbox then after you can save it to a .java not back to a .mmg
Is this possible? I think so but I am greatly bad with coding.
NOTE: In VB.NET Please
Re: [HELP]New save format?
Posted: Fri Dec 02, 2011 12:35 am
by comathi
It is indeed possible, and here is one way of doing it:
1. Put this to open the file
Code: Select allTry
Dim dlg As New OpenFileDialog
dlg.Title = "Open File..."
dlg.Filter = "MMG Files (*.mmg) | *.mmg"
If dlg.ShowDialog = DialogResult.Ok Then
RichTextBox1.LoadFile (dlg.filename, PlainText)
End If
Catch ex As Exception
End Try
2. And now for the save
Code: Select allTry
Dim dlg As New SaveFileDialog
dlg.Title = "Save File..."
dlg.Filter = "Java Files (*.java) | *.java"
If dlg.ShowDialog = DialogResult.Ok Then
RichTextBox1.SaveFile (dlg.filename, PlainText)
End If
Catch ex As Exception
End Try
For the parts where it says "PlainText", you'll have to erase part of the word so VB starts giving you suggestions. From the list it should give you, just select the one that contains the "Plain Text". Sorry for any typos, I'm on a mobile device right now, but I hope this helps
Sincerely,
Comathi

Re: [HELP]New save format?
Posted: Fri Dec 02, 2011 1:03 am
by Frozen
comathi wrote:It is indeed possible, and here is one way of doing it:
1. Put this to open the file
Code: Select allTry
Dim dlg As New OpenFileDialog
dlg.Title = "Open File..."
dlg.Filter = "MMG Files (*.mmg) | *.mmg"
If dlg.ShowDialog = DialogResult.Ok Then
RichTextBox1.LoadFile (dlg.filename, PlainText)
End If
Catch ex As Exception
End Try
2. And now for the save
Code: Select allTry
Dim dlg As New SaveFileDialog
dlg.Title = "Save File..."
dlg.Filter = "Java Files (*.java) | *.java"
If dlg.ShowDialog = DialogResult.Ok Then
RichTextBox1.SaveFile (dlg.filename, PlainText)
End If
Catch ex As Exception
End Try
For the parts where it says "PlainText", you'll have to erase part of the word so VB starts giving you suggestions. From the list it should give you, just select the one that contains the "Plain Text". Sorry for any typos, I'm on a mobile device right now, but I hope this helps 
Sincerely,
Comathi 
Comathi thanks I really do appreciate it! I got it to work after figuring out that puzzle about the "PlainText" but all I needed to do is reread it

Re: [HELP]New save format?
Posted: Fri Dec 02, 2011 2:22 am
by comathi
You're welcome

Just tell me if you need any more help
And sorry for the puzzle
