[vb.net] Geen ActiveX maar hoe dan?

Pagina: 1
Acties:

  • Swerfer
  • Registratie: Mei 2003
  • Laatst online: 13-05 23:51
Ik wil een ActiveX component maken waarbij ik in een website meerdere locale files kan selecteren, die ik daarna upload.

Nu ben ik erachter dat vb.net geen activex meer ondersteund, maar toch wil ik gebruik maken van vb.net om mijn doel te bereiken.

Ik heb al een vb.net applicatie gemaakt die bovenstaande kan uitvoeren, maar ik weet niet hoe ik zo'n soort applicatie kan maken om in een website te 'embedden', zoals een activex component.

Na veel speurwerk heb ik wel (maar) één voorbeeld gevonden in C#,
http://www.c-sharpcorner....03/March/ActiveXInNet.asp, maar die krijg ik niet aan de praat, waarschijnlijk omdat ik te weinig kennis bezit van C#. Een vb.net versie van dit voorbeeld,
http://www.vbdotnetheaven.com/Code/Jun2003/2067.asp, werkt al helemaal niet, en die krijg ik ook met geen mogelijkheid aan de praat.

Weet iemand dit vb.net voorbeeld werkend te krijgen, of kan iemand mij op weg helpen, of weet iemand een site met een goede uitleg voor het maken van een soort van activex component?

Of is er een heel andere manier om met vb.net zo'n embedded webapplicatie te maken?

Misschien heb ik wel verkeerde trefwoorden gebruikt om te zoeken met google. Onderstaande combinaties heb ik oa. al geprobeerd:

activex control visual basic .net
visual basic .net activex control
visual basic .net componenten assemblies
visual basic .net dll usercontrol

Home Assistant | Unifi | LG 51MR.U44 | Volvo EX30 SMER+ Vapour Grey, trekhaak | SmartEVSE V3 | Cronos Crypto.com


  • tijn
  • Registratie: Februari 2000
  • Laatst online: 22-03 21:36
Je kunt het beste zoeken op 'hosting .net in ie' of zoiets. Het kan namelijk wel, zie bijvoorbeeld http://www.devhood.com/Tu...ails.aspx?tutorial_id=388.

Hou er echter wel rekening mee dat de client-kant dan wel het .NET framework geinstalleerd moet hebben (wat bij een ActiveX wrapper ook het geval is trouwens).

Cuyahoga .NET website framework


  • Gerco
  • Registratie: Mei 2000
  • Laatst online: 08-05 18:46

Gerco

Professional Newbie

Misschien off-topic, maar waarom gebruik je niet gewoon meerdere <input type="file"/> tags ?

- "Als ik zou willen dat je het begreep, legde ik het wel beter uit!" | All number systems are base 10!


  • Swerfer
  • Registratie: Mei 2003
  • Laatst online: 13-05 23:51
tijn schreef op zaterdag 19 februari 2005 @ 12:56:
Je kunt het beste zoeken op 'hosting .net in ie' of zoiets. Het kan namelijk wel, zie bijvoorbeeld http://www.devhood.com/Tu...ails.aspx?tutorial_id=388.

Hou er echter wel rekening mee dat de client-kant dan wel het .NET framework geinstalleerd moet hebben (wat bij een ActiveX wrapper ook het geval is trouwens).
Ik denk dat ik hier wel wat mee kan. Ik ga er eens mee aan de slag.

Dat de client het .NET framework geinstalleerd moet hebben daar had ik al rekening mee gehouden.
Gerco schreef op zaterdag 19 februari 2005 @ 12:57:
Misschien off-topic, maar waarom gebruik je niet gewoon meerdere <input type="file"/> tags ?
Voor bijvoorbeeld 100 files? En geen mogelijkheid om meerdere files tegelijk te selecteren? Nee dank je. Tevens wil ik client-side wat bewerkingen kunnen uitvoeren alvorens de bestanden worden geupload.

[ Voor 26% gewijzigd door Swerfer op 19-02-2005 16:08 ]

Home Assistant | Unifi | LG 51MR.U44 | Volvo EX30 SMER+ Vapour Grey, trekhaak | SmartEVSE V3 | Cronos Crypto.com


  • Swerfer
  • Registratie: Mei 2003
  • Laatst online: 13-05 23:51
Ik heb een C# script werkend gekregen:
C#:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace devhood
{
    public class rtfcontrol : System.Windows.Forms.UserControl
    {
        private System.Windows.Forms.RichTextBox richTextBox1;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Button btnBold;
        private System.Windows.Forms.Button btnItalic;
        private System.ComponentModel.Container components = null;

        public rtfcontrol()
        {
            InitializeComponent();
        }
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if( components != null )
                    components.Dispose();
            }
            base.Dispose( disposing );
        }

        #region Component Designer generated code

        private void InitializeComponent()
        {
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.panel1 = new System.Windows.Forms.Panel();
            this.btnItalic = new System.Windows.Forms.Button();
            this.btnBold = new System.Windows.Forms.Button();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
            // 
            // richTextBox1
            // 
            this.richTextBox1.BackColor = System.Drawing.Color.White;
            this.richTextBox1.Location = new System.Drawing.Point(0, 40);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.Size = new System.Drawing.Size(488, 432);
            this.richTextBox1.TabIndex = 0;
            this.richTextBox1.Text = "";
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.Color.LightGray;
            this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                 this.btnItalic,
                                                                                 this.btnBold});
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(488, 40);
            this.panel1.TabIndex = 1;
            // 
            // btnItalic
            // 
            this.btnItalic.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, 
                System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.btnItalic.Location = new System.Drawing.Point(72, 8);
            this.btnItalic.Name = "btnItalic";
            this.btnItalic.Size = new System.Drawing.Size(56, 24);
            this.btnItalic.TabIndex = 1;
            this.btnItalic.Text = "Italic";
            this.btnItalic.Click += new System.EventHandler(this.btnItalic_Click);
            // 
            // btnBold
            // 
            this.btnBold.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, 
                System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.btnBold.Location = new System.Drawing.Point(8, 8);
            this.btnBold.Name = "btnBold";
            this.btnBold.Size = new System.Drawing.Size(56, 24);
            this.btnBold.TabIndex = 0;
            this.btnBold.Text = "Bold";
            this.btnBold.Click += new System.EventHandler(this.btnBold_Click);
            // 
            // rtfcontrol
            // 
            this.BackColor = System.Drawing.Color.LightGray;
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.panel1,
                                                                          this.richTextBox1});
            this.Name = "rtfcontrol";
            this.Size = new System.Drawing.Size(488, 472);
            this.panel1.ResumeLayout(false);
            this.ResumeLayout(false);

        }
        #endregion

        private void btnBold_Click(object sender, System.EventArgs e)
        {
            if (this.richTextBox1.SelectionFont.Bold)
                this.richTextBox1.SelectionFont = new Font(this.richTextBox1.SelectionFont, FontStyle.Regular);
            else
                this.richTextBox1.SelectionFont = new Font(this.richTextBox1.SelectionFont, FontStyle.Bold);
        }

        private void btnItalic_Click(object sender, System.EventArgs e)
        {
            if (this.richTextBox1.SelectionFont.Italic)
                this.richTextBox1.SelectionFont = new Font(this.richTextBox1.SelectionFont, FontStyle.Regular);
            else
                this.richTextBox1.SelectionFont = new Font(this.richTextBox1.SelectionFont, FontStyle.Italic);
        }
    }
}

Nu heb ik de C# code omgezet in VB, maar nu krijg ik hem niet aan de praat embedded in een website. Als usercontrol in een applicatie werkt hij wel :?

Onderstannde code is de VB uitvoering:
Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Windows.Forms

Namespace devhood

    Public Class rtfcontrol
        Inherits System.Windows.Forms.UserControl

        Private Panel1 As System.Windows.Forms.Panel
        Private RichTextBox1 As System.Windows.Forms.RichTextBox
        Private btnItalic As System.Windows.Forms.Button
        Private btnBold As System.Windows.Forms.Button

        Private components As System.ComponentModel.Container

        Public Sub New()
            MyBase.New()
            InitializeComponent()
        End Sub

        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub

#Region "Component Designer generated code"

        Private Sub InitializeComponent()
            Me.RichTextBox1 = New System.Windows.Forms.RichTextBox
            Me.Panel1 = New System.Windows.Forms.Panel
            Me.btnItalic = New System.Windows.Forms.Button
            Me.btnBold = New System.Windows.Forms.Button
            Me.Panel1.SuspendLayout()
            Me.SuspendLayout()
            '
            'RichTextBox1
            '
            Me.RichTextBox1.BackColor = System.Drawing.Color.White
            Me.RichTextBox1.Location = New System.Drawing.Point(0, 40)
            Me.RichTextBox1.Name = "RichTextBox1"
            Me.RichTextBox1.Size = New System.Drawing.Size(488, 432)
            Me.RichTextBox1.TabIndex = 0
            Me.RichTextBox1.Text = ""
            '
            'Panel1
            '
            Me.Panel1.BackColor = System.Drawing.Color.LightGray
            Me.Panel1.Controls.Add(Me.btnItalic)
            Me.Panel1.Controls.Add(Me.btnBold)
            Me.Panel1.Name = "Panel1"
            Me.Panel1.Size = New System.Drawing.Size(488, 40)
            Me.Panel1.TabIndex = 1
            '
            'btnItalic
            '
            Me.btnItalic.Location = New System.Drawing.Point(104, 8)
            Me.btnItalic.Name = "btnItalic"
            Me.btnItalic.Size = New System.Drawing.Size(88, 24)
            Me.btnItalic.TabIndex = 1
            Me.btnItalic.Text = "Italic"
            '
            'btnBold
            '
            Me.btnBold.Font = New System.Drawing.Font("Arial", 9.0!)
            Me.btnBold.Location = New System.Drawing.Point(8, 8)
            Me.btnBold.Name = "btnBold"
            Me.btnBold.Size = New System.Drawing.Size(88, 24)
            Me.btnBold.TabIndex = 0
            Me.btnBold.Text = "Bold"
            '
            'rtfcontrol
            '
            Me.BackColor = System.Drawing.Color.LightGray
            Me.Controls.Add(Me.RichTextBox1)
            Me.Controls.Add(Me.Panel1)
            Me.Name = "rtfcontrol"
            Me.Size = New System.Drawing.Size(488, 472)
            Me.Panel1.ResumeLayout(False)
            Me.ResumeLayout(False)

        End Sub

#End Region

        Private Sub btnBold_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            If RichTextBox1.SelectionFont.Bold Then
                RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Regular)
            Else
                RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Bold)
            End If
        End Sub

        Private Sub btnItalic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            If RichTextBox1.SelectionFont.Italic Then
                RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Regular)
            Else
                RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Italic)
            End If
        End Sub

    End Class
End Namespace


Ik gebruik onderstaande HTML om de pagina op te roepen:
HTML:
1
2
3
4
5
6
7
8
9
<html>
  <body>
   <center>
     <object id="rtfcontrol" height="472" width="488"
         classid="http://192.168.0.2/test/WindowsControlLibrary3.dll#devhood.rtfcontrol">
     </object>
   </center>
  </body>
</html>

Ik zal wel iets simpels over het hoofd zien, maar ik kan maar niet vinden wat...

[ Voor 204% gewijzigd door Swerfer op 19-02-2005 16:21 ]

Home Assistant | Unifi | LG 51MR.U44 | Volvo EX30 SMER+ Vapour Grey, trekhaak | SmartEVSE V3 | Cronos Crypto.com


  • Swerfer
  • Registratie: Mei 2003
  • Laatst online: 13-05 23:51
***Kick*** :X

Home Assistant | Unifi | LG 51MR.U44 | Volvo EX30 SMER+ Vapour Grey, trekhaak | SmartEVSE V3 | Cronos Crypto.com


  • Swerfer
  • Registratie: Mei 2003
  • Laatst online: 13-05 23:51
Ik heb een VB.NET voorbeeld gevonden op internet, simpeler kan bijna niet, maar om de één of andere reden werkt het niet :(

Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Namespace Test
    Public Class UserControl1
        Inherits System.Windows.Forms.UserControl
#Region " Windows Form Designer generated code "

        Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call

        End Sub

        'UserControl1 overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        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()
            components = New System.ComponentModel.Container
        End Sub

#End Region
        Public Function change_color(ByVal color_param As String)
            Me.BackColor = Color.FromArgb(255, Int("&H" + Mid(color_param, 2, 2)), _
             Int("&H" + Mid(color_param, 4, 2)), Int("&H" + Mid(color_param, 6, 2)))
        End Function
    End Class
End Namespace

En de HTML:
HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<html>
    <head>
        <script>
            function changecolor() 
                {
                User_Control.change_color(document.bgColor);
                }
        </script>
    </head>
    <body MS_POSITIONING="FlowLayout">
        <input
            type="button"
            value="Match Color with Back Ground"
            onclick="changecolor()"
            ID="Button1"
            NAME="Button1">
        <br>
        <object
            id="User_Control"
            classid="WindowsControlLibrary4.dll#Test.UserControl1"
            height="300"
            width="300">
        </object>
    </body> 
</html>


Ook hier werkt de usercontrol wel in een Windows applicatie in VB.NET, maar niet vanaf het internet. Het lijkt wel of het aan de client ligt, maar ik heb dit op meer computers binnen mijn netwerk geprobeerd.

http://62.216.6.190/test/...olLibrary4/bin/test4.html
Bovenstaande link zou nu hetzelfde moeten doen als omschreven op deze site:
http://www.builderau.com....,39024644,20275326,00.htm

http://62.216.6.190/test/...indowsControlLibrary4.dll
Bovenstaande link is de link naar de gegenereerde dll. Misschien kan iemand het op zijn server proberen om te zien of het bij mij misschien op de server fout gaat. Al kan dat bijna niet zou ik zeggen, de dll wordt gewoon gedownload...

O ja, ik heb natuurlijk het .net Framework geinstalleerd...

Home Assistant | Unifi | LG 51MR.U44 | Volvo EX30 SMER+ Vapour Grey, trekhaak | SmartEVSE V3 | Cronos Crypto.com


  • OZ-Gump
  • Registratie: November 2002
  • Laatst online: 14-05-2024

OZ-Gump

terug van weggeweest

Je krijgt fouten op je pagina en je usercontrol wordt niet eens weergegeven. Ik moet eerlijk zeggen dat ik ook nog nooit een usercontrol geladen heb zien worden door een object in te voegen waar je als classid DLLnaam#Usercontrolnaam gebruikt. Volgens mij is dat ook geen geldige manier van usercontrols gebruiken?

Overigens is de opmerking 'Het werkt niet' mischien niet de beste om je probleem te omschrijven, omdat het op die manier niet echt heel duidelijk is wat er nou eigenlijk aan de hand is. Debug zelf ook een beetje!

[ Voor 26% gewijzigd door OZ-Gump op 20-02-2005 16:20 ]

My personal website


  • Swerfer
  • Registratie: Mei 2003
  • Laatst online: 13-05 23:51
Het vreemde is dat dat ik het C# voorbeeld wel werkend heb gekregen. Het lijkt fout te gaan op het moment dat ik een VB.NET gecompileerde dll gebruik.

Om te verduidelijken wat er niet werkt:

Ik krijg niet de usercontrol in mijn explorer window, maar het bekende icoontje met een rood vierkantje en een groen rondje en een blauw driehoekje...

Afbeeldingslocatie: http://62.216.6.190/test/icoontje.gif

Home Assistant | Unifi | LG 51MR.U44 | Volvo EX30 SMER+ Vapour Grey, trekhaak | SmartEVSE V3 | Cronos Crypto.com


  • Swerfer
  • Registratie: Mei 2003
  • Laatst online: 13-05 23:51
Ik heb het al (nou ja al :o ) gevonden... Ik moet geen Namespace opgeven. Als ik deze regel weglaat, en dan in de html classid="WindowsControlLibrary4.dll#WindowsControlLibrary4.UserControl1" opgeef, dan werkt alles wel.

Home Assistant | Unifi | LG 51MR.U44 | Volvo EX30 SMER+ Vapour Grey, trekhaak | SmartEVSE V3 | Cronos Crypto.com


  • tijn
  • Registratie: Februari 2000
  • Laatst online: 22-03 21:36
Tsss bizar hoor. Ik dacht eerst dat het er wel mee te maken zou hebben dat VB.NET de programmeur standaard 'beschermt' tegen ingewikkelde dingen als namespaces maar ik zie inderdaad toch duidelijk een namespace in je code staan.

Cuyahoga .NET website framework

Pagina: 1