[Solved!]New save format?

If your a member of codenstuff then this is the main place to be. Get together..talk..chat and ponder. Have fun. Chill out. Play games.
4 posts Page 1 of 1
Contributors
User avatar
Frozen
VIP - Donator
VIP - Donator
Posts: 46
Joined: Thu Jul 21, 2011 8:34 pm

[Solved!]New save format?
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
Last edited by Frozen on Fri Dec 02, 2011 10:46 pm, edited 1 time in total.
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: [HELP]New save format?
comathi
It is indeed possible, and here is one way of doing it:

1. Put this to open the file
Code: Select all
Try
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 all
Try
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 :D

Sincerely,

Comathi :)
User avatar
Frozen
VIP - Donator
VIP - Donator
Posts: 46
Joined: Thu Jul 21, 2011 8:34 pm

Re: [HELP]New save format?
Frozen
comathi wrote:
It is indeed possible, and here is one way of doing it:

1. Put this to open the file
Code: Select all
Try
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 all
Try
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 :D

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 :D
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: [HELP]New save format?
comathi
You're welcome :D Just tell me if you need any more help :)

And sorry for the puzzle :)
4 posts Page 1 of 1
Return to “Codenstuff boardroom”