Skip to content

Commit fd72512

Browse files
committed
Update to .NET 5 & newer standards
1 parent ae305a2 commit fd72512

8 files changed

+121
-239
lines changed

Stopwatch/App.config

-6
This file was deleted.

Stopwatch/My Project/Application.Designer.vb

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
33
<MySubMain>true</MySubMain>
4-
<MainForm>Form1</MainForm>
4+
<MainForm>MainForm</MainForm>
55
<SingleInstance>false</SingleInstance>
66
<ShutdownMode>0</ShutdownMode>
77
<EnableVisualStyles>true</EnableVisualStyles>
88
<AuthenticationMode>0</AuthenticationMode>
9-
<ApplicationType>0</ApplicationType>
109
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
11-
</MyApplicationData>
10+
</MyApplicationData>

Stopwatch/My Project/AssemblyInfo.vb

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Imports System.Runtime.InteropServices
99
' Review the values of the assembly attributes
1010

1111
<Assembly: AssemblyTitle("Stopwatch")>
12-
<Assembly: AssemblyDescription("")>
12+
<Assembly: AssemblyDescription("A small Stopwatch I made for recording purposes.")>
1313
<Assembly: AssemblyCompany("")>
1414
<Assembly: AssemblyProduct("Stopwatch")>
15-
<Assembly: AssemblyCopyright("Copyright © 2020")>
15+
<Assembly: AssemblyCopyright("GPL-3.0")>
1616
<Assembly: AssemblyTrademark("")>
1717

1818
<Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' by using the '*' as shown below:
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("1.0.0.0")>
35-
<Assembly: AssemblyFileVersion("1.0.0.0")>
34+
<Assembly: AssemblyVersion("2.0.0.0")>
35+
<Assembly: AssemblyFileVersion("2.0.0.0")>

Stopwatch/Stopwatch.Designer.vb

+49-45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Stopwatch/Stopwatch.resx

+2-62
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<root>
3-
<!--
4-
Microsoft ResX Schema
5-
6-
Version 2.0
7-
8-
The primary goals of this format is to allow a simple XML format
9-
that is mostly human readable. The generation and parsing of the
10-
various data types are done through the TypeConverter classes
11-
associated with the data types.
12-
13-
Example:
14-
15-
... ado.net/XML headers & schema ...
16-
<resheader name="resmimetype">text/microsoft-resx</resheader>
17-
<resheader name="version">2.0</resheader>
18-
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19-
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20-
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21-
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22-
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23-
<value>[base64 mime encoded serialized .NET Framework object]</value>
24-
</data>
25-
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26-
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27-
<comment>This is a comment</comment>
28-
</data>
29-
30-
There are any number of "resheader" rows that contain simple
31-
name/value pairs.
32-
33-
Each data row contains a name, and value. The row also contains a
34-
type or mimetype. Type corresponds to a .NET class that support
35-
text/value conversion through the TypeConverter architecture.
36-
Classes that don't support this are serialized and stored with the
37-
mimetype set.
38-
39-
The mimetype is used for serialized objects, and tells the
40-
ResXResourceReader how to depersist the object. This is currently not
41-
extensible. For a given mimetype the value must be set accordingly:
42-
43-
Note - application/x-microsoft.net.object.binary.base64 is the format
44-
that the ResXResourceWriter will generate, however the reader can
45-
read any of the formats listed below.
46-
47-
mimetype: application/x-microsoft.net.object.binary.base64
48-
value : The object must be serialized with
49-
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50-
: and then encoded with base64 encoding.
51-
52-
mimetype: application/x-microsoft.net.object.soap.base64
53-
value : The object must be serialized with
54-
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55-
: and then encoded with base64 encoding.
56-
57-
mimetype: application/x-microsoft.net.object.bytearray.base64
58-
value : The object must be serialized into a byte array
59-
: using a System.ComponentModel.TypeConverter
60-
: and then encoded with base64 encoding.
61-
-->
1+
<root>
622
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
633
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
644
<xsd:element name="root" msdata:IsDataSet="true">
@@ -117,7 +57,7 @@
11757
<resheader name="writer">
11858
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
11959
</resheader>
120-
<metadata name="tmr_second.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
60+
<metadata name="Timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
12161
<value>17, 17</value>
12262
</metadata>
12363
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Stopwatch/Stopwatch.vb

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
1-
Public Class Frm_stopwatch
2-
Dim time As Date
3-
Dim hours As Byte
1+
Public Class MainForm
2+
Dim _time As Date
3+
Dim _hours As Byte
44

55
Private Sub Input()
66
Dim temp As String()
7-
temp = txt_io.Text.Split(":")
8-
hours = temp(0)
9-
time = "00:" & temp(1) & ":" & temp(2)
7+
temp = IOTxt.Text.Split(":")
8+
_hours = temp(0)
9+
_time = "00:" & temp(1) & ":" & temp(2)
1010
End Sub
1111

1212
Private Sub Output()
13-
txt_io.Text = hours.ToString.PadLeft(2, "0") + ":" + time.ToString("mm:ss")
13+
IOTxt.Text = _hours.ToString.PadLeft(2, "0") + ":" + _time.ToString("mm:ss")
1414
End Sub
1515

1616
Private Sub StartAll()
17-
tmr_second.Start()
18-
txt_io.ReadOnly = True
19-
cmd_startstop.Text = "Stop"
17+
Timer.Start()
18+
IOTxt.ReadOnly = True
19+
StartButton.Text = "Stop"
2020
End Sub
2121

2222
Private Sub StopAll()
23-
tmr_second.Stop()
24-
txt_io.ReadOnly = False
25-
cmd_startstop.Text = "Start"
23+
Timer.Stop()
24+
IOTxt.ReadOnly = False
25+
StartButton.Text = "Start"
2626
End Sub
2727

28-
Private Sub Cmd_startstop_Click(sender As Object, e As EventArgs) Handles cmd_startstop.Click
29-
If cmd_startstop.Text.Equals("Start") Then
28+
Private Sub StartButton_Click(sender As Object, e As EventArgs) Handles StartButton.Click
29+
If StartButton.Text.Equals("Start") Then
3030
Try
3131
Input()
3232
Catch ex As Exception
3333
MsgBox(ex.Message, MsgBoxStyle.Critical)
3434
Exit Sub
3535
End Try
3636
StartAll()
37-
cmd_resetrestore.Text = "Reset"
38-
ElseIf cmd_startstop.Text.Equals("Stop") Then
37+
ResetButton.Text = "Reset"
38+
ElseIf StartButton.Text.Equals("Stop") Then
3939
StopAll()
4040
End If
4141
End Sub
4242

43-
Private Sub Cmd_resetrestore_Click(sender As Object, e As EventArgs) Handles cmd_resetrestore.Click
44-
If cmd_resetrestore.Text.Equals("Reset") Then
43+
Private Sub ResetButton_Click(sender As Object, e As EventArgs) Handles ResetButton.Click
44+
If ResetButton.Text.Equals("Reset") Then
4545
StopAll()
46-
txt_io.Text = "00:00:00"
47-
cmd_resetrestore.Text = "Restore"
48-
ElseIf cmd_resetrestore.Text.Equals("Restore") Then
46+
IOTxt.Text = "00:00:00"
47+
ResetButton.Text = "Restore"
48+
ElseIf ResetButton.Text.Equals("Restore") Then
4949
Output()
50-
cmd_resetrestore.Text = "Reset"
50+
ResetButton.Text = "Reset"
5151
End If
5252
End Sub
5353

54-
Private Sub Tmr_second_Tick(sender As Object, e As EventArgs) Handles tmr_second.Tick
55-
If time.ToString("mm:ss") = "59:59" Then
54+
Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick
55+
If _time.ToString("mm:ss") = "59:59" Then
5656
Try
57-
hours += 1
57+
_hours += 1
5858
Catch ex As OverflowException
5959
StopAll()
6060
MsgBox(ex.Message, MsgBoxStyle.Critical)
6161
End Try
6262
End If
63-
time = time.AddSeconds(1)
63+
_time = _time.AddSeconds(1)
6464
Output()
6565
End Sub
6666
End Class

0 commit comments

Comments
 (0)