Jump to content
Xbox Modders Community
Sign in to follow this  
CyberSaint

Programming in Visual Basic | For Those Who Have Errors

Recommended Posts

This is a tutorial for those who keep getting errors. Don't worry, we have all been there.

 

I will simply give you a template that you can use to create your programs. 

 

 

 

Imports PackageIO



Public Class Form1
 
Dim Filepath As String



Private Sub ButtonItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem3.Click

Dim Open As New OpenFileDialog

Open.Filter = "Gamesave (*.*)|*.*"

Open.Title = "Open Gamesave"

If Open.ShowDialog = Windows.Forms.DialogResult.OK Then

Filepath = Open.FileName

Else

Return

End If

End Sub
 
(This Code Will Allow You To Open The Save)

----------------------------------------------------------------------------------------------------------

Private Sub ButtonItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem4.Click

Try

WriteFile()

MsgBox(("File Saved!"))

ReadFile()

Catch ex As Exception

MsgBox("Error", MsgBoxStyle.Critical, "")

End Try

End Sub
 
(This Code Will Allow You To Save The File)

----------------------------------------------------------------------------------------------------------

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Public Sub ReadFile()

Dim Reader As New PackageIO.Reader(Filepath, PackageIO.Endian.Big)

Reader.Position = "Hex Value" (Without Quotes)
NumericUpDown1.Value = Reader.ReadInt32

Reader.Position = "Hex Value" (Without Quotes)
NumericUpDown2.Value = Reader.ReadInt32

Reader.Close()

End Sub
 
(This Code Will Tell The Program To Read The Current Values Of The Original Save "Does Not Always Work, But Don't Worry, Not a Big Issue")
---------------------------------------------------------------------------------------------------------

Public Sub WriteFile()

Dim Writer As New PackageIO.Writer(Filepath, PackageIO.Endian.Big)

Writer.Position = "Hex Value" (Without Quotes)
Writer.WriteInt32(NumericUpDown3.Value)

Writer.Position = "Hex Value" (Without Quotes)
Writer.WriteInt32(NumericUpDown4.Value)

Writer.Close()

End Sub

End Class
 
(This Final Code Will Tell The Program To Overwrite The Values Of The Original Save)

 

Have Fun Programming! If you have any errors, please feel free to contact me. ;)

Share this post


Link to post
Share on other sites

I never get errors, just syntax.

Share this post


Link to post
Share on other sites

I never get errors, just syntax.

Umm ok, well this tutorial is for those who get errors.

Share this post


Link to post
Share on other sites

Umm ok, well this tutorial is for those who get errors.

Whine about it?

Share this post


Link to post
Share on other sites

Whine about it?

 

Whine about what? 

Share this post


Link to post
Share on other sites

Whine about what? 

:facepalm: Nevermind

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.