-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.vb
64 lines (60 loc) · 2.61 KB
/
Main.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Public Class Main
Private Sub Main_Load(sender As Object, e As EventArgs) Handles Me.Load
'ButtonCreateChild.Enabled = False
End Sub
Dim NewName As String
Private Sub TextBoxRName_Click(sender As Object, e As EventArgs) Handles TextBoxRName.Click
TextBoxRName.Text = ""
End Sub
Private Sub ButtonCreate_Click(sender As Object, e As EventArgs) Handles ButtonCreate.Click
If TextBoxRName.Text = "Please Enter Registry Name" Then
MsgBox("Please Enter Registry Name")
TextBoxRName.Text = ""
ElseIf TextBoxRName.Text = "" Then
MsgBox("Please Enter Registry Name")
Else
NewName = TextBoxRName.Text
My.Computer.Registry.CurrentUser.CreateSubKey(NewName)
MsgBox("Parent Created")
ButtonCreateChild.Enabled = True
End If
End Sub
Private Sub ButtonCreateChild_Click(sender As Object, e As EventArgs) Handles ButtonCreateChild.Click
If TextBoxChild.Text = "" Then
MsgBox("Please Enter Child Name")
ElseIf TextBoxChild.Text = "Please Enter Child Name" Then
MsgBox("Please Enter Child Name")
TextBoxChild.Text = ""
Else
If TextBoxChildValue.Text = "" Then
MsgBox("Please Enter Child Value")
ElseIf TextBoxChildValue.Text = "Please Enter Child Value" Then
MsgBox("Please Enter Child value")
TextBoxChild.Text = ""
Else
NewName = TextBoxRName.Text
Dim RegisLoc As String = "HKEY_CURRENT_USER\" + NewName
My.Computer.Registry.SetValue(RegisLoc, TextBoxChild.Text, TextBoxChildValue.Text)
MsgBox("Pair Created")
End If
End If
End Sub
Private Sub ButtonRead_Click(sender As Object, e As EventArgs) Handles ButtonRead.Click
If TextBoxRead.Text = "" Then
MsgBox("Please enter value to read")
Else
If TextBoxReadChild.Text = "" Then
MsgBox("Please enter value to read")
Else
Dim inpputval As String = TextBoxRead.Text
Dim inputchild As String = "HKEY_CURRENT_USER\" + TextBoxReadChild.Text
Dim readValue = My.Computer.Registry.GetValue(inputchild, inpputval, Nothing)
If My.Computer.Registry.GetValue(inputchild, inpputval, Nothing) Is Nothing Then
MsgBox("Value does not exist.")
Else
MsgBox("Value :" & readValue)
End If
End If
End If
End Sub
End Class