473,416 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Edit Menu

Can anyone tell me how to create a Edit menu
I am new to VB .Net and this news group

Thanks,

Brian
May 13 '07 #1
1 1263
Brian,

This is a simple exanmple I created for you

Public Class Form1
Inherits System.Windows.Forms.Form

#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

'Form 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.
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()Private Sub
InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.MenuItem3 = New System.Windows.Forms.MenuItem
Me.MenuItem4 = New System.Windows.Forms.MenuItem
Me.MenuItem5 = New System.Windows.Forms.MenuItem
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem()
{Me.MenuItem1, Me.MenuItem3})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem()
{Me.MenuItem2})
Me.MenuItem1.Text = "File"
'
'MenuItem2
'
Me.MenuItem2.Index = 0
Me.MenuItem2.Text = "Exit"
'
'MenuItem3
'
Me.MenuItem3.Index = 1
Me.MenuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem()
{Me.MenuItem4, Me.MenuItem5})
Me.MenuItem3.Text = "Edit"
'
'MenuItem4
'
Me.MenuItem4.Index = 0
Me.MenuItem4.Text = "Copy"
'
'MenuItem5
'
Me.MenuItem5.Index = 1
Me.MenuItem5.Text = "Paste"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(16, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(96, 20)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "Text to copy"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(128, 16)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = ""
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(240, 57)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScree n
Me.Text = "Edit Example"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem2.Click
Application.Exit()
End Sub

Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem4.Click
If TextBox1.SelectedText <"" Then
Clipboard.SetDataObject(TextBox1.SelectedText)
End If
End Sub

Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem5.Click
Dim iData As IDataObject = Clipboard.GetDataObject()
If iData.GetDataPresent(DataFormats.Text) Then
TextBox2.Text = CType(iData.GetData(DataFormats.Text), String)
End If
End Sub
End Class

I hope this helps,

--
Newbie Coder
(It's just a name)
"Brian Heibert" <he*****@verizon.netwrote in message
news:uU**************@TK2MSFTNGP03.phx.gbl...
Can anyone tell me how to create a Edit menu
I am new to VB .Net and this news group

Thanks,

Brian


May 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carl Gilbert | last post by:
Hi I have recently been having trouble with the edit items in both the context menu and edit menu in vs.net designer. On the context menu, the only items that are not disabled are 'View code'...
1
by: Bryan Van. | last post by:
Hello, I've had Visual Studio .NET for C# only two weeks now. Today I encounter a big problem with the developer. The edit menu is disabled! Both using the right click of the mouse, the edit menu...
1
by: Michael Rodriguez | last post by:
I created an edit menu with the standard Cut, Copy and Paste. I then assigned shortcuts to each menu, CtrlX, CtrlC, etc. However, if I select some text in a textbox and choose one of these items,...
5
by: Max | last post by:
I thought in server explorer, I could add or edit stored procedures, but all I can do is refresh and run... -Max
5
by: Cecilia Bergengruen | last post by:
2 questions: 1)I inserted a menu in an mdi window form. I right clicked on a menu item and pressed edit names. I therefore edited all my menu item names. Then I right clicked and pressed edit...
6
by: Larry Woods | last post by:
I am trying to name my submenus (MainMenu control) and they show up in the menu dropdown...like they are O.K., but when I check my controls the names are still "MenuItemX". OTOH, the top-level...
0
by: Peter Stojkovic | last post by:
I have a Userobject with a contextMenu. Now I can't insert or edit per GUI MeniItems by EDIT MENU How can I solve the the problem ? Have other User the same problem ?? Peter Stojkovic
1
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is...
0
by: anupam roy | last post by:
Hi, I have two editors in my .NET C# application. One is rich text box another is custom layout editor for resource editiing. Now i have configured the main meny edit buttons to work for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.