Skip to content

Commit 6c0bdfd

Browse files
committed
fix compile errors
1 parent 04c02b8 commit 6c0bdfd

38 files changed

+644
-1141
lines changed

snippets/visualbasic/Microsoft.VisualBasic.ApplicationServices/User/Overview/VbVbalrMyUser.vbproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<OutputType>Exe</OutputType>
44
<TargetFramework>net481-windows</TargetFramework>
55
<UseWindowsForms>true</UseWindowsForms>
6+
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
67
</PropertyGroup>
78
</Project>

snippets/visualbasic/Microsoft.VisualBasic.Devices/Audio/Overview/Class1.vb

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
Option Strict On
22
Option Explicit On
3+
Imports System.Windows.Forms
34

45
Class Class1
6+
Public Shared Sub Main()
7+
End Sub
8+
59
Public Sub testClock()
610
'<snippet21>
711
MsgBox("Current local time: " & My.Computer.Clock.LocalTime)
@@ -18,18 +22,18 @@ Class Class1
1822
Loop
1923
End Sub
2024

21-
Private Function IsTimeUp(
22-
ByVal startTicks As Integer,
23-
ByVal seconds As Integer
25+
Private Function IsTimeUp(
26+
ByVal startTicks As Integer,
27+
ByVal seconds As Integer
2428
) As Boolean
2529
' This function throws an overflow exception if the
2630
' tick count difference is greater than 2,147,483,647,
2731
' about 24 days for My.Computer.Clock.TickCount.
2832

2933
' Use UInteger to simplify the code for roll over.
30-
Dim uStart As UInteger =
34+
Dim uStart As UInteger =
3135
CUInt(CLng(startTicks) - Integer.MinValue)
32-
Dim uCurrent As UInteger =
36+
Dim uCurrent As UInteger =
3337
CUInt(CLng(My.Computer.Clock.TickCount) - Integer.MinValue)
3438

3539
' Calculate the tick count difference.
@@ -52,50 +56,50 @@ Class Class1
5256

5357
'<snippet17>
5458
Sub PlaySystemSound()
55-
My.Computer.Audio.PlaySystemSound(
59+
My.Computer.Audio.PlaySystemSound(
5660
System.Media.SystemSounds.Asterisk)
5761
End Sub
5862
'</snippet17>
5963

6064
'<snippet16>
6165
Sub PlayBackgroundSoundResource()
62-
My.Computer.Audio.Play(My.Resources.Waterfall,
66+
My.Computer.Audio.Play(My.Resources.Waterfall,
6367
AudioPlayMode.WaitToComplete)
6468
End Sub
6569
'</snippet16>
6670

6771
'<snippet15>
6872
Sub PlayBackgroundSoundFile()
69-
My.Computer.Audio.Play("C:\Waterfall.wav",
73+
My.Computer.Audio.Play("C:\Waterfall.wav",
7074
AudioPlayMode.WaitToComplete)
7175
End Sub
7276
'</snippet15>
7377

7478
'<snippet14>
7579
Sub PlaySoundResource()
76-
My.Computer.Audio.Play(My.Resources.Waterfall,
80+
My.Computer.Audio.Play(My.Resources.Waterfall,
7781
AudioPlayMode.WaitToComplete)
7882
End Sub
7983
'</snippet14>
8084

8185
'<snippet13>
8286
Sub PlaySoundFile()
83-
My.Computer.Audio.Play("C:\Waterfall.wav",
87+
My.Computer.Audio.Play("C:\Waterfall.wav",
8488
AudioPlayMode.WaitToComplete)
8589
End Sub
8690
'</snippet13>
8791

8892
'<snippet12>
8993
Sub PlayLoopingBackgroundSoundResource()
90-
My.Computer.Audio.Play(My.Resources.Waterfall,
94+
My.Computer.Audio.Play(My.Resources.Waterfall,
9195
AudioPlayMode.BackgroundLoop)
9296
End Sub
9397
'</snippet12>
9498

9599
'<snippet19>
96100
'<snippet11>
97101
Sub PlayLoopingBackgroundSoundFile()
98-
My.Computer.Audio.Play("C:\Waterfall.wav",
102+
My.Computer.Audio.Play("C:\Waterfall.wav",
99103
AudioPlayMode.BackgroundLoop)
100104
End Sub
101105
'</snippet11>
@@ -121,35 +125,35 @@ Class Class1
121125
MsgBox("Computer name: " & My.Computer.Name)
122126
'</snippet1>
123127
'<snippet2>
124-
MsgBox("Computer's available physical memory: " &
128+
MsgBox("Computer's available physical memory: " &
125129
My.Computer.Info.AvailablePhysicalMemory)
126130
'</snippet2>
127131
'<snippet3>
128-
MsgBox("Computer's available virtual memory: " &
132+
MsgBox("Computer's available virtual memory: " &
129133
My.Computer.Info.AvailableVirtualMemory)
130134
'</snippet3>
131135
'<snippet4>
132-
MsgBox("Computer's UI culture name: " &
136+
MsgBox("Computer's UI culture name: " &
133137
My.Computer.Info.InstalledUICulture.DisplayName)
134138
'</snippet4>
135139
'<snippet5>
136-
MsgBox("Computer's operating system name: " &
140+
MsgBox("Computer's operating system name: " &
137141
My.Computer.Info.OSFullName)
138142
'</snippet5>
139143
'<snippet6>
140-
MsgBox("Computer's operating system platform: " &
144+
MsgBox("Computer's operating system platform: " &
141145
My.Computer.Info.OSPlatform)
142146
'</snippet6>
143147
'<snippet7>
144-
MsgBox("Computer's operating system version: " &
148+
MsgBox("Computer's operating system version: " &
145149
My.Computer.Info.OSVersion)
146150
'</snippet7>
147151
'<snippet8>
148-
MsgBox("Computer's available physical memory: " &
152+
MsgBox("Computer's available physical memory: " &
149153
My.Computer.Info.TotalPhysicalMemory)
150154
'</snippet8>
151155
'<snippet9>
152-
MsgBox("Computer's available virtual memory: " &
156+
MsgBox("Computer's available virtual memory: " &
153157
My.Computer.Info.TotalVirtualMemory)
154158
'</snippet9>
155159

snippets/visualbasic/Microsoft.VisualBasic.Devices/Audio/Overview/Class2.vb

Lines changed: 71 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
Option Explicit On
22
Option Strict On
3+
Imports System.Windows.Forms
4+
5+
36

47
''''''''''''''''
58
' Keyboard
69
'''''''''''''''
710

811
Namespace Keyboard
912
Class Class0746a247f57e45fc93b7de462bef9206
10-
13+
1114
Public Sub Method23()
1215
' 0746a247-f57e-45fc-93b7-de462bef9206
1316
' My.Computer.Keyboard.AltKeyDown Property
@@ -18,7 +21,7 @@ Namespace Keyboard
1821
MsgBox("ALT key up")
1922
End If
2023
' </snippet23>
21-
24+
2225
' 3a08efec-d444-4200-9341-fff79474d0cc
2326
' My.Computer.Keyboard.ScrollLock Property
2427
' <snippet31>
@@ -121,7 +124,7 @@ Namespace Keyboard
121124
End Sub
122125

123126
End Class
124-
127+
125128
End Namespace
126129

127130
''''''''''''''''
@@ -136,7 +139,7 @@ Namespace Ports
136139
' <snippet27>
137140
Sub DialModem()
138141
' Dial a number via an attached modem on COM1.
139-
Using com1 As IO.Ports.SerialPort =
142+
Using com1 As IO.Ports.SerialPort =
140143
My.Computer.Ports.OpenSerialPort("COM1", 9600)
141144
' <snippet29>
142145
com1.DtrEnable = True
@@ -151,7 +154,7 @@ Namespace Ports
151154

152155
Public Sub Method28()
153156
' <snippet28>
154-
Using com1 As IO.Ports.SerialPort =
157+
Using com1 As IO.Ports.SerialPort =
155158
My.Computer.Ports.OpenSerialPort("COM1", 9600)
156159
End Using
157160
' </snippet28>
@@ -172,7 +175,7 @@ Namespace Ports
172175
' <snippet33>
173176
Sub SendSerialData(ByVal data As String)
174177
' Send strings to a serial port.
175-
Using com1 As IO.Ports.SerialPort =
178+
Using com1 As IO.Ports.SerialPort =
176179
My.Computer.Ports.OpenSerialPort("COM1")
177180
com1.WriteLine(data)
178181
End Using
@@ -184,71 +187,71 @@ Namespace Ports
184187
' 8371ce2c-e1c7-476b-a86d-9afc2614b6b7
185188
' How to: Receive Strings From Serial Ports in Visual Basic
186189

187-
' <snippet37>
188-
Function ReceiveSerialData() As String
189-
' Receive strings from a serial port.
190-
' <snippet38>
191-
Dim returnStr As String = ""
192-
' </snippet38>
193-
194-
Dim com1 As IO.Ports.SerialPort = Nothing
195-
Try
196-
com1 = My.Computer.Ports.OpenSerialPort("COM1")
197-
com1.ReadTimeout = 10000
190+
' <snippet37>
191+
Function ReceiveSerialData() As String
192+
' Receive strings from a serial port.
193+
' <snippet38>
194+
Dim returnStr As String = ""
195+
' </snippet38>
196+
197+
Dim com1 As IO.Ports.SerialPort = Nothing
198+
Try
199+
com1 = My.Computer.Ports.OpenSerialPort("COM1")
200+
com1.ReadTimeout = 10000
201+
Do
202+
' <snippet41>
203+
Dim Incoming As String = com1.ReadLine()
204+
' </snippet41>
205+
If Incoming Is Nothing Then
206+
Exit Do
207+
' <snippet43>
208+
Else
209+
returnStr &= Incoming & vbCrLf
210+
' </snippet43>
211+
End If
212+
Loop
213+
Catch ex As TimeoutException
214+
returnStr = "Error: Serial Port read timed out."
215+
Finally
216+
If com1 IsNot Nothing Then com1.Close()
217+
End Try
218+
219+
' <snippet44>
220+
Return returnStr
221+
' </snippet44>
222+
End Function
223+
' </snippet37>
224+
225+
Public Sub Method39()
226+
Dim returnStr As String
227+
198228
Do
199-
' <snippet41>
200-
Dim Incoming As String = com1.ReadLine()
201-
' </snippet41>
229+
Dim Incoming As String = ""
230+
' <snippet42>
202231
If Incoming Is Nothing Then
203232
Exit Do
204-
' <snippet43>
205-
Else
206-
returnStr &= Incoming & vbCrLf
207-
' </snippet43>
208233
End If
234+
' </snippet42>
209235
Loop
210-
Catch ex As TimeoutException
211-
returnStr = "Error: Serial Port read timed out."
212-
Finally
213-
If com1 IsNot Nothing Then com1.Close()
214-
End Try
215-
216-
' <snippet44>
217-
Return returnStr
218-
' </snippet44>
219-
End Function
220-
' </snippet37>
221-
222-
Public Sub Method39()
223-
Dim returnStr As String
224-
225-
Do
226-
Dim Incoming As String = ""
227-
' <snippet42>
228-
If Incoming Is Nothing Then
229-
Exit Do
230-
End If
231-
' </snippet42>
232-
Loop
233-
234-
' <snippet39>
235-
Dim com1 As IO.Ports.SerialPort = Nothing
236-
Try
237-
com1 = My.Computer.Ports.OpenSerialPort("COM1")
238-
com1.ReadTimeout = 10000
239-
240-
Catch ex As TimeoutException
241-
returnStr = "Error: Serial Port read timed out."
242-
Finally
243-
If com1 IsNot Nothing Then com1.Close()
244-
End Try
245-
' </snippet39>
246-
247-
' <snippet40>
248-
Do
249-
Loop
250-
' </snippet40>
251-
End Sub
236+
237+
' <snippet39>
238+
Dim com1 As IO.Ports.SerialPort = Nothing
239+
Try
240+
com1 = My.Computer.Ports.OpenSerialPort("COM1")
241+
com1.ReadTimeout = 10000
242+
243+
Catch ex As TimeoutException
244+
returnStr = "Error: Serial Port read timed out."
245+
Finally
246+
If com1 IsNot Nothing Then com1.Close()
247+
End Try
248+
' </snippet39>
249+
250+
' <snippet40>
251+
Do
252+
Loop
253+
' </snippet40>
254+
End Sub
252255

253256
End Class
254257

@@ -291,10 +294,10 @@ Namespace Mouse
291294
If My.Computer.Mouse.WheelExists Then
292295
Dim lines As Integer = My.Computer.Mouse.WheelScrollLines
293296
If lines > 0 Then
294-
MsgBox("Application scrolls " &
297+
MsgBox("Application scrolls " &
295298
lines & " line(s) for each wheel turn.")
296299
Else
297-
MsgBox("Application scrolls " &
300+
MsgBox("Application scrolls " &
298301
(-lines) & " page(s) for each wheel turn.")
299302
End If
300303
Else

snippets/visualbasic/Microsoft.VisualBasic.Devices/Audio/Overview/My Project/Application.Designer.vb

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)