Skip to content

Commit 48a2d44

Browse files
committed
Small sample on Visual Basic
1 parent f3ff771 commit 48a2d44

File tree

8 files changed

+245
-0
lines changed

8 files changed

+245
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Imports Microsoft.VisualBasic.ApplicationServices
2+
3+
Namespace My
4+
' The following events are available for MyApplication:
5+
' Startup: Raised when the application starts, before the startup form is created.
6+
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
7+
' UnhandledException: Raised if the application encounters an unhandled exception.
8+
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
9+
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
10+
11+
' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application.
12+
13+
' Example:
14+
' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults
15+
'
16+
' ' Setting the application-wide default Font:
17+
' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular)
18+
'
19+
' ' Setting the HighDpiMode for the Application:
20+
' e.HighDpiMode = HighDpiMode.PerMonitorV2
21+
'
22+
' ' If a splash dialog is used, this sets the minimum display time:
23+
' e.MinimumSplashScreenDisplayTime = 4000
24+
' End Sub
25+
26+
Partial Friend Class MyApplication
27+
28+
End Class
29+
End Namespace

SampleVisualBasic/MainForm.Designer.vb

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SampleVisualBasic/MainForm.resx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<root>
2+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
3+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
4+
<xsd:element name="root" msdata:IsDataSet="true">
5+
<xsd:complexType>
6+
<xsd:choice maxOccurs="unbounded">
7+
<xsd:element name="metadata">
8+
<xsd:complexType>
9+
<xsd:sequence>
10+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
11+
</xsd:sequence>
12+
<xsd:attribute name="name" use="required" type="xsd:string" />
13+
<xsd:attribute name="type" type="xsd:string" />
14+
<xsd:attribute name="mimetype" type="xsd:string" />
15+
<xsd:attribute ref="xml:space" />
16+
</xsd:complexType>
17+
</xsd:element>
18+
<xsd:element name="assembly">
19+
<xsd:complexType>
20+
<xsd:attribute name="alias" type="xsd:string" />
21+
<xsd:attribute name="name" type="xsd:string" />
22+
</xsd:complexType>
23+
</xsd:element>
24+
<xsd:element name="data">
25+
<xsd:complexType>
26+
<xsd:sequence>
27+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
28+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
29+
</xsd:sequence>
30+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
31+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
32+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
33+
<xsd:attribute ref="xml:space" />
34+
</xsd:complexType>
35+
</xsd:element>
36+
<xsd:element name="resheader">
37+
<xsd:complexType>
38+
<xsd:sequence>
39+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
40+
</xsd:sequence>
41+
<xsd:attribute name="name" type="xsd:string" use="required" />
42+
</xsd:complexType>
43+
</xsd:element>
44+
</xsd:choice>
45+
</xsd:complexType>
46+
</xsd:element>
47+
</xsd:schema>
48+
<resheader name="resmimetype">
49+
<value>text/microsoft-resx</value>
50+
</resheader>
51+
<resheader name="version">
52+
<value>2.0</value>
53+
</resheader>
54+
<resheader name="reader">
55+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
56+
</resheader>
57+
<resheader name="writer">
58+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
59+
</resheader>
60+
</root>

SampleVisualBasic/MainForm.vb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Public Class MainForm
2+
3+
End Class

SampleVisualBasic/My Project/Application.Designer.vb

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1004 Bytes
Binary file not shown.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net7.0-windows</TargetFramework>
6+
<StartupObject>Sub Main</StartupObject>
7+
<UseWindowsForms>true</UseWindowsForms>
8+
<MyType>WindowsForms</MyType>
9+
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
10+
<PublishAot>true</PublishAot>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<Import Include="System.Data" />
15+
<Import Include="System.Drawing" />
16+
<Import Include="System.Windows.Forms" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<Compile Update="My Project\Application.Designer.vb">
21+
<DesignTime>True</DesignTime>
22+
<AutoGen>True</AutoGen>
23+
<DependentUpon>Application.myapp</DependentUpon>
24+
</Compile>
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<None Update="My Project\Application.myapp">
29+
<Generator>MyApplicationCodeGenerator</Generator>
30+
<LastGenOutput>Application.Designer.vb</LastGenOutput>
31+
</None>
32+
</ItemGroup>
33+
34+
</Project>

WinFormsComInterop.sln

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "facades", "facades", "{B446
5050
EndProject
5151
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.WebView2.Core", "facades\Microsoft.Web.WebView2.Core\Microsoft.Web.WebView2.Core.csproj", "{B6EFF1A5-63B5-4A05-9B9A-410BA94B92AA}"
5252
EndProject
53+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SampleVisualBasic", "SampleVisualBasic\SampleVisualBasic.vbproj", "{D868429A-3252-4314-9E55-4332CCD09A20}"
54+
EndProject
5355
Global
5456
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5557
Debug|Any CPU = Debug|Any CPU
@@ -292,6 +294,22 @@ Global
292294
{B6EFF1A5-63B5-4A05-9B9A-410BA94B92AA}.Release|x64.Build.0 = Release|Any CPU
293295
{B6EFF1A5-63B5-4A05-9B9A-410BA94B92AA}.Release|x86.ActiveCfg = Release|Any CPU
294296
{B6EFF1A5-63B5-4A05-9B9A-410BA94B92AA}.Release|x86.Build.0 = Release|Any CPU
297+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
298+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|Any CPU.Build.0 = Debug|Any CPU
299+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|arm64.ActiveCfg = Debug|Any CPU
300+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|arm64.Build.0 = Debug|Any CPU
301+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|x64.ActiveCfg = Debug|Any CPU
302+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|x64.Build.0 = Debug|Any CPU
303+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|x86.ActiveCfg = Debug|Any CPU
304+
{D868429A-3252-4314-9E55-4332CCD09A20}.Debug|x86.Build.0 = Debug|Any CPU
305+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|Any CPU.ActiveCfg = Release|Any CPU
306+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|Any CPU.Build.0 = Release|Any CPU
307+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|arm64.ActiveCfg = Release|Any CPU
308+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|arm64.Build.0 = Release|Any CPU
309+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|x64.ActiveCfg = Release|Any CPU
310+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|x64.Build.0 = Release|Any CPU
311+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|x86.ActiveCfg = Release|Any CPU
312+
{D868429A-3252-4314-9E55-4332CCD09A20}.Release|x86.Build.0 = Release|Any CPU
295313
EndGlobalSection
296314
GlobalSection(SolutionProperties) = preSolution
297315
HideSolutionNode = FALSE
@@ -309,6 +327,7 @@ Global
309327
{0131FA3C-FCE1-464E-B45E-9ACA4E92B263} = {B8E0DDAA-1A19-409C-AD36-7B32A997446A}
310328
{36317E5D-29E1-4622-AC0A-F2A99C29CE1C} = {B8E0DDAA-1A19-409C-AD36-7B32A997446A}
311329
{B6EFF1A5-63B5-4A05-9B9A-410BA94B92AA} = {B446ED5F-1D77-4709-AFBB-F5CAE585B964}
330+
{D868429A-3252-4314-9E55-4332CCD09A20} = {B8E0DDAA-1A19-409C-AD36-7B32A997446A}
312331
EndGlobalSection
313332
GlobalSection(ExtensibilityGlobals) = postSolution
314333
SolutionGuid = {E6AF9777-3A1E-4FF6-A531-49CD8D66A293}

0 commit comments

Comments
 (0)