Murray Brown
asked on
VB.net Error in convering code behind a form from C# to VB.net
Hi
I am trying to convert the C# code at the bottom to the VB.net code just above.
I have one error at the line:
Me.toolStrip1.LocationChan ged = Sub(sender As Object, e As EventArgs) Me.panel1.Height = Me.toolStrip1.Top
The error is
Error 1 'Public Event LocationChanged(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. C:\Users\murbro\documents\ visual studio 2010\Projects\Infra_WinFor ms\Infra_W inForms\Fo rm1.vb 22 9 Infra_WinForms
Imports System.Drawing
Imports System.Windows.Forms
Public Class Form1
Public Sub New()
InitializeComponent()
' Make your controls movable by a mouseclick
Helper.ControlMover.Init(M e.button1)
Helper.ControlMover.Init(M e.checkBox 1)
Helper.ControlMover.Init(M e.groupBox 1)
Helper.ControlMover.Init(M e.textBox1 )
Helper.ControlMover.Init(M e.label1)
' Move a panel by its toolstrip
Helper.ControlMover.Init(M e.toolStri p2, Me.panel3, Helper.ControlMover.Direct ion.Any)
' Make a splitter from toolstrip
Helper.ControlMover.Init(M e.toolStri p1, Helper.ControlMover.Direct ion.Vertic al)
Me.toolStrip1.LocationChan ged = Sub(sender As Object, e As EventArgs) Me.panel1.Height = Me.toolStrip1.Top
End Sub
End Class
using System;
using System.Drawing;
using System.Windows.Forms;
namespace MoveYourControls
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// Move your controls
Helper.ControlMover.Init(t his.button 1);
Helper.ControlMover.Init(t his.checkB ox1);
Helper.ControlMover.Init(t his.groupB ox1);
Helper.ControlMover.Init(t his.textBo x1);
Helper.ControlMover.Init(t his.label1 );
// Move a panel by its toolstrip
Helper.ControlMover.Init(t his.toolSt rip2, this.panel3, Helper.ControlMover.Direct ion.Any);
// Make a splitter from toolstrip
Helper.ControlMover.Init(t his.toolSt rip1, Helper.ControlMover.Direct ion.Vertic al);
this.toolStrip1.LocationCh anged += delegate(object sender, EventArgs e)
{
this.panel1.Height = this.toolStrip1.Top;
};
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
I am trying to convert the C# code at the bottom to the VB.net code just above.
I have one error at the line:
Me.toolStrip1.LocationChan
The error is
Error 1 'Public Event LocationChanged(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. C:\Users\murbro\documents\
Imports System.Drawing
Imports System.Windows.Forms
Public Class Form1
Public Sub New()
InitializeComponent()
' Make your controls movable by a mouseclick
Helper.ControlMover.Init(M
Helper.ControlMover.Init(M
Helper.ControlMover.Init(M
Helper.ControlMover.Init(M
Helper.ControlMover.Init(M
' Move a panel by its toolstrip
Helper.ControlMover.Init(M
' Make a splitter from toolstrip
Helper.ControlMover.Init(M
Me.toolStrip1.LocationChan
End Sub
End Class
using System;
using System.Drawing;
using System.Windows.Forms;
namespace MoveYourControls
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// Move your controls
Helper.ControlMover.Init(t
Helper.ControlMover.Init(t
Helper.ControlMover.Init(t
Helper.ControlMover.Init(t
Helper.ControlMover.Init(t
// Move a panel by its toolstrip
Helper.ControlMover.Init(t
// Make a splitter from toolstrip
Helper.ControlMover.Init(t
this.toolStrip1.LocationCh
{
this.panel1.Height = this.toolStrip1.Top;
};
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER