Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I know how to embed form icon and explorer icon in Visual Studio
But I need this also in vbc.exe command line option because in
my computer in my company I have .NET framework but no Visual Studio.

I tried the following command line:

' C:\WINDOWS\Microsoft.NET\Framework\v3.5\vbc /target:winexe /win32icon:exeIcon.ico /resource:formIcon.ico icons_test.vb
'


But only the explorer icon is embedded. The form icon do not embedded.

Do I miss some code in my app

Thank you very much.

What I have tried:

'
' C:\WINDOWS\Microsoft.NET\Framework\v3.5\vbc /target:winexe /win32icon:exeIcon.ico /resource:formIcon.ico icons_test.vb
'
Option Strict Off
Imports System
Imports System.Windows.Forms  
 
Module test_050520

 Sub Main()  
   Dim myForm As New Form1
   myForm.ShowDialog()
 End Sub

End Module


Public Class Form1

   Public Sub New()
     MyBase.New()

     'This call is required by the Windows Form Designer.
     InitializeComponent()
     'Add any initialization after the InitializeComponent() call

   End Sub

End Class


<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.SuspendLayout()
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(588, 305)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

End Class
Posted
Updated 6-May-20 9:18am
Comments
evry1falls 5-May-20 20:54pm    
How did you EMBED explorer ICON ?
Member 13569650 6-May-20 0:23am    
Hi evry1falls and thank you.

I embedded the explorer icon by this compiler option

/win32icon:exeIcon.ico

only without any code in app

the code in what I tried
is a complete app you can compile it with vbc.exe as I posted in my question.
for .ico files use one from yours

Thank you
evry1falls 6-May-20 12:03pm    
In Visual Studio we use Resources.
Try this :
Me.Icon = New Icon(Me.GetType(), "YOUR_Icon_Path_File.ico")
Member 13569650 6-May-20 13:34pm    
Hi evry1falls (I accept this name statement)

Wow!!! its work

I was know that this something simple but worked
a week to find that something simple.
and at last you come as help to me.

I am very thank you.
Thanks.
evry1falls 6-May-20 15:18pm    
Please, accept as solution

1 solution

Me.Icon = New Icon(Me.GetType(), "YOUR_Icon_Path_File.ico")
 
Share this answer
 
Comments
Maciej Los 6-May-20 15:20pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900