Title | Display the full name of an assembly in VB .NET |
Description | This example shows how to display the full name of an assembly in VB .NET. |
Keywords | assembly, full name, FullName, reflection, VB .NET |
Categories | VB.NET |
|
|
This program lets you enter the location of an assembly or click a browse button to locate one. When you click the browse button, the program displays a File Open dialog. If you select an assembly and click OK, it places the location of the file you selected in its TextBox.
|
|
Private Sub btnBrowse_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnBrowse.Click
dlgFindFile.CheckFileExists = True
dlgFindFile.Title = "Select Assembly"
If dlgFindFile.ShowDialog(Me) = DialogResult.OK Then
txtPath.Text = dlgFindFile.FileName
End If
End Sub
|
|
After you enter or select a file's location and click the Go button, the prorgam creates an Assembly object that describes the location you entered. It then displays the Assembly's FullName value. Note that the code must include the type Assembly in square brackets because "Assembly" is also a keyword.
|
|
Private Sub btnGo_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnGo.Click
Dim assem As [Assembly] = _
[Assembly].LoadFrom(txtPath.Text)
txtResult.Text = assem.FullName()
End Sub
|
|
|
|