VB.net 2010 Msgbox builder with stub
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
This tutorial is how you create a msgbox builder with stub
First we gonna build the stub
Create a new form project
1. Double click on form1
Form1.Load
Now we need the msgbox builder first we need a new project
so create a new form project.
When that is done we need.
1. 3 Buttons
2. 4 Radio buttons
3. 3 textboxes
4. 3 labels
Text in button1 it should be "Test"
Text in button2 should be "Build"
Text in button3 should be "Info"
Rename the 4 radiobuttons to
"Critical" " Information" "YesNo "Exclamation"
And put the text the same as name.
now textbox1 should just keep its name
textbox2 should be named "msgtitle"
and textbox3 should be named msgbody
Put 1 label over msgtitle in the label you write "Title"
put another label over msgbody on that you write "Text"
over textbox1 you put the last label and write "Name" in it
no we need the code
Over Public class form1
when that is imported into it go to solution explorer and find stub.exe under resources folder click on it and change "none" in build action to embed resource
create a form2 and put some info about it
now build your msgbox builder and it should work with the stub inside it
Please inform me if anything is wrong with the code or anything else
when your done it should look something like this

First we gonna build the stub
Create a new form project
1. Double click on form1
Form1.Load
Code: Select all
Now we have the stub we build it. Me.Height = 0
Me.Width = 0
Me.Opacity = 0
Me.Hide()
Me.Visible = False
Me.ShowInTaskbar = False
Me.ShowIcon = False
Dim msgtitle, msgbody As String
Dim Critical, information, yesno, exclamation As Boolean
Dim BinText As String = IO.File.ReadAllText(Application.ExecutablePath)
If BinText.Contains("FileSpilt") = False Then Exit Sub
Dim ArrContents() As String = Split(BinText, "FileSpilt")
msgtitle = ArrContents(1)
msgbody = ArrContents(2)
Critical = ArrContents(3)
information = ArrContents(4)
yesno = ArrContents(5)
exclamation = ArrContents(6)
If Critical = True Then
MsgBox(msgbody, MsgBoxStyle.Critical, msgtitle)
ElseIf information = True Then
MsgBox(msgbody, MsgBoxStyle.Information, msgtitle)
ElseIf yesno = True Then
MsgBox(msgbody, MsgBoxStyle.YesNo, msgtitle)
ElseIf exclamation = True Then
MsgBox(msgbody, MsgBoxStyle.Exclamation, msgtitle)
End If
Me.Close()
Try
Catch ex As Exception
End Try
Now we need the msgbox builder first we need a new project
so create a new form project.
When that is done we need.
1. 3 Buttons
2. 4 Radio buttons
3. 3 textboxes
4. 3 labels
Text in button1 it should be "Test"
Text in button2 should be "Build"
Text in button3 should be "Info"
Rename the 4 radiobuttons to
"Critical" " Information" "YesNo "Exclamation"
And put the text the same as name.
now textbox1 should just keep its name
textbox2 should be named "msgtitle"
and textbox3 should be named msgbody
Put 1 label over msgtitle in the label you write "Title"
put another label over msgbody on that you write "Text"
over textbox1 you put the last label and write "Name" in it
no we need the code
Over Public class form1
Code: Select all
Button1
Imports System.IO
Code: Select all
Button2
If Critical.Checked = True Then
MsgBox(msgbody.Text, MsgBoxStyle.Critical, msgtitle.Text)
ElseIf Information.Checked = True Then
MsgBox(msgbody.Text, MsgBoxStyle.Information, msgtitle.Text)
ElseIf YesNo.Checked = True Then
MsgBox(msgbody.Text, MsgBoxStyle.YesNo, msgtitle.Text)
ElseIf Exclamation.Checked = True Then
MsgBox(msgbody.Text, MsgBoxStyle.Exclamation, msgtitle.Text)
End If
Code: Select all
Button3
Dim b As Byte() = My.Resources.Stub
Dim TheFIlePath As String = Application.StartupPath & "\Stub.exe"
Dim TempFile As System.IO.FileStream = IO.File.Create(TheFIlePath)
TempFile.Write(b, 0, b.Length)
TempFile.Close()
IO.File.Copy(CurDir() & "\stub.exe", CurDir() & "\" + TextBox1.Text + ".exe")
IO.File.AppendAllText(CurDir() & "\" + TextBox1.Text + ".exe", "FileSpilt" & msgtitle.Text & "FileSpilt" & msgbody.Text & "FileSpilt" & Critical.Checked & "FileSpilt" & Information.Checked & "FileSpilt" & YesNo.Checked & "FileSpilt" & Exclamation.Checked)
MsgBox("Done!", MsgBoxStyle.Information)
Process.Start(CurDir)
System.IO.File.Delete(Application.StartupPath & ("\Stub.exe"))
Code: Select all
now we import the stub we made into the msgbox builder form so go to my project then go to resources tab click ad resouce "add existing file" find the stub.exeForm2.Show()
when that is imported into it go to solution explorer and find stub.exe under resources folder click on it and change "none" in build action to embed resource
create a form2 and put some info about it
now build your msgbox builder and it should work with the stub inside it
Please inform me if anything is wrong with the code or anything else
when your done it should look something like this

You do not have the required permissions to view the files attached to this post.
Looks awesome!
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

mandai wrote:What is this used for?It creates a msgbox that popup when you click on the exe file it creates
Really useless anyway a Msgbox exe Builder but ok,nice code...
Jg99 wrote:nice code, I will + rep u!Thanks
Well done, since u seem good at this, do u know if its possible that I make a program, where a user selects what he wants and a new .exe will be compiled with their desired features. Thanks in advance. 8-)
shekoasinger wrote:Well done, since u seem good at this, do u know if its possible that I make a program, where a user selects what he wants and a new .exe will be compiled with their desired features. Thanks in advance. 8-)Could you explain it a little more ?
You can compile applications by using the VBCodeProvider class, check out http://support.microsoft.com/kb/304654
Copyright Information
Copyright © Codenstuff.com 2020 - 2023