|
Hi Gurus,
Am dynamically generating context menus from database.
I want to capture the click event on the menu item.
For example.
My context menu has
Copy
Rename
Send email
how will i know if "Rename" menu item or any other menu item has been clicked.
So that i can process different context menu click items
Please help me...
Thanks in advance
Sasidhar
|
|
|
|
|
Try setting the .OnAction property, for example
...
Dim cmdbarMenuItemCtl As CommandBarControl
... code to create command bar control etc.
cmdbarMenuItemCtl.Caption = "Send Mail"
'Set the .OnAction (click) property. When user clicks, the function
'MyFunctionName will be called with a string parameter containing an email address
cmdbarMenuItemCtl.OnAction = "=MyFunctionName('" & strEmailAddress & "')"
...
Jeremy
|
|
|
|
|
Sasidhar
You need to register an event handler for each menu item as you add it.
<br />
Dim mnuItem As MenuItem<br />
mnuItem = New Windows.Forms.MenuItem(MenuItemName, New System.EventHandler(AddressOf Me.MenuItem_Click))<br />
mnuMain.MenuItems.Add(mnuItem)
And then you obviously need the event handler as well. Use the sender.index value to determine which item in the menu has been clicked.
Private Sub MenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
Dim ItemIx As Integer = sender.index<br />
End Sub
Hope this helps
Bernhard
Don't worry, nobody lives forever.
|
|
|
|
|
Hi,
Where can I get source code of a Forum Board that uses Access as the back-end database? I have looked through several, but can't find any that uses Access as the database.
Any links or ideas?
Thanks...
|
|
|
|
|
|
Hey guys,
Well i hope somebody can help with this. Want to insert a picture in an Excel spreadsheet programatically using Visual Basic 6. It is possible n easy i guess but the real problem is that i want the picture to be inserted at a particular position say for example i wanna have the picture at P25 then what. Please consider that i m a beginner. thanx for all who help me out with this.
bye ;P
|
|
|
|
|
Hello Every body.
i cant add the data from the text boxes in the list veiw.
i have checked it but i cant.
can any one please tell me the coding.
thanks and with best regards.
Usman
|
|
|
|
|
We'll need a bit more detail about how you are using the listview to completely answer your qeustion. Some things like what mode the ListView is in? Are you using columns? What's the error your getting?
Also, how about posting what code you have so we can tell you what your doing wrong?
The basic add to a ListView from a TextBox:
ListView1.Items.Add( TextBox1.Text )
RageInTheMachine9532
|
|
|
|
|
List1.AddItem Rs2.Fields("name")
|
|
|
|
|
I made application using .NET 2002.and iam using crystal report.i deployed ina client system.but whe n i tried in another system,at the completion stage of setup ,it showing some error that "Crystl32.OCX" has failed to regsiter.and it is asking wether you want to countinue , retry or Ignore.clicking countinue setup can be completed.
But my application having user login interface,that is geting loaded,but further cant go.
PLease suggest me .i have tried to register Crystl32.OCX manually,that also not alowing me to do.and i tried to install crystal report 8.5 in order solve,that also not possible ,set up showing some error.
But this application is working fine in my development system using setup.
i have used all the merge module which require for .NET 2002 and crystal report.This is also happend in the 3rd system.
|
|
|
|
|
When you create your setup file you may need to add the ocx manually. VS.Net doesn't always pick up all the dependancies.
Definitely a PEBCAK! (Problem Exists Between Keyboard And Chair) My First ASP.Net site is now up http://www.redravenrpg.com
|
|
|
|
|
should i copy OCX into system32 folder,do i have to register?please explain me un detail.....thanxs
|
|
|
|
|
I want to set up the cell content in the datagrid, like this:
dgSample.Item(dgSample.CurrentCell.RowNumber, 0) = "2004"
but I always got the error message: "The ListManager's position must be equal to rowNum". Does anyone know what it means? Thanks.
|
|
|
|
|
I am developing a asp.net website, and I am using a vb.net code-behind file. In the code-behind file, I am trying to do the following code
Sub NewsLinks_ItemCommand( s As Object, e As DataListCommandEventArgs )
Dim ArticleID as integer
NewsLinks.SelectedIndex = e.Item.ItemIndex
ArticleID = NewsLinks.DataKeys( e.Item.ItemIndex )
GetFile(ArticleID)
End Sub
Where NewsLinks is a DataList in the Asp.net side. However I keep getting the error
Type 'DataListCommandEventArgs' is not defined.
I have the following Imports at the top of the page:
Imports System
Imports System.Web
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
I think I am just forgetting to do something like import the right file. Am I missing one or doing something else wrong?
I am also getting this same type of error when I try this
Private Sub Page_Change(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
Dim start As Integer
start = CommercialGrid.CurrentPageIndex * CommercialGrid.PageSize
CommercialGrid.CurrentPageIndex = e.NewPageIndex
PopulateDataGrid()
End Sub
Only the error I get is this
Type 'DataGridPageChangedEventArgs' is not defined.
Thanks in advance!
jeremy
|
|
|
|
|
How do I create the code of a form with two checkedlistboxes and a value for each of the checks. So when the user clicks a checkbox on one form the rest of the check choices become grayed out and the other one becomes selectable and then the user can only pick one of them?
John
I am avidly interested in graphics and ado.net
|
|
|
|
|
I am building a dice game, with rotating dice. The dice will have 1-6 dots on each side. I am also building a class to play the game, but can't figure out how to send a message to roll the dice in the class without the class knowing about the simulating rolling dice, how is this done?
I am avidly interested in graphics and ado.net
|
|
|
|
|
Some code samples would be helpful. Since we can't see your design, there is no way we can tell you what your doing right or wrong.
RageInTheMachine9532
|
|
|
|
|
I am just trying to get started!
|
|
|
|
|
First, what do you mean by "roll the dice in the class without the class knowing about the simulating rolling dice"?
Does this mean that you have 2 seperate classes, something that is displaying graphics dice and something else that actually picks the numbers that the dice will show? Is this a user control you've written to display the dice?
RageInTheMachine9532
|
|
|
|
|
class dice
dim adie1 as int16
dim adie2 as int16
property die1 as int16
get
return adie1
end get
set
sdie1=value
end set
'What I am trying to is to make sure that the class is self-contained'
' it can roll the die on the form and count the value of the die
private function count_die (die1 as int16, die2 as int 16)as int16
dim total as int16
total=die1+die2
return total
public sub getFirstRoll (die1 as int16, die2 as int16)as int16<-- returns array
dim firstroll()as int16
redim firstroll(rolls)
firstroll(rolls)= count_die(die1,die2)
rolls=rolls+1
return firstroll
'test rolls!
I am avidly interested in graphics and ado.net
|
|
|
|
|
If you have a visual component that display rotating dice, you might want to consider building your class into a UserControl (Windows Control Library). That way, you can put your dice logic and visual elements in one place instead of having to worry about synchronizing two seperate classes.
RageInTheMachine9532
|
|
|
|
|
Heres some code that may point you in the right direction. It is Airware so the syntax will not be correct:-
Class DiceDisplay
Property Display as PictureBox
Property NoOfDice as int16
Property Pips as int16
Public Sub RollEm
Dim Roller as DiceRoller(NoOfDice, Pips)
Roller.Roll
DrawDice(Roller)
End Function
Public Sub DrawDice(ByRef Results as DiceRoller)
Dim Index as Int16
For Index = 1 to NoOfDice
DrawDiceImage(Roller.Results(Index))
Next Index
End sub
End Class
Class DiceRoller
Property Results as arraylist
Public Sub Roll(ByVal NoOfDice as int16, ByVal Pips as int16)
Dim Index as int16
For Index = 1 to NoOfDice
Results.Add(convert.toint16(rnd(Pips)))
Next Index
End Sub
End Class
Definitely a PEBCAK! (Problem Exists Between Keyboard And Chair)
My first ASP.Net site is now up http://www.redravenrpg.com
|
|
|
|
|
I have a problem with vb 6.0.
On a form I have put a bound datagrid control - used to list various items from a table stored in an Access database.
Among these items are graphics (company logos) - and I would like to use the DBpix control to display these logos - together with name, adresses etc.
In general - is it possible to have a bound control inside the datagrid, so that the control can be activated for each record in the underlying table ?
Blom Eng.
|
|
|
|
|
this may sound really basic and i'm sure it is. but throughout all of the books i've read (being self taught) i've never come across how to get the string in a text box on one form another text box/label/whatever on another form.
for example:
say form1 has a textbox for inputting a users name. how can i then display that name on form2 in a label control?
thanks in advance
cheers
|
|
|
|
|
xtremean wrote:
i've never come across how to get the string in a text box on one form another text box/label/whatever on another form.
That's because your thinking about the code on one form directly manipulating the controls on another form. The reason you don't see that in the books is because it's bad practice.
What you should be thinking about is having public variables somewhere that both forms can access. For example, you have two forms, one has a string that needs to be passed to the second. The first form just has a label, a textbox and a button on it:
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim newForm As New Form2
newForm.strDataThisFormNeeds = TextBox1.Text
newForm.Show()
End Sub
End Class
Form1 is simple, just type something in the textbox and click a button to send the string to Form2. The code in the button click just creates a new instance of Form2 and set the public variable that Form2 exposes to the string in Form1's textbox. Form2 just has a label and a textbox on it and exposes a public string like this:
Public Class Form2
Inherits System.Windows.Forms.Form
Public strDataThisFormNeeds As String
Private Sub Form2_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
TextBox1.Text = strDataThisFormNeeds
End Sub
End Class
This is just a VERY simple example and does NOT show all the possible methods of passing data between forms!
RageInTheMachine9532
|
|
|
|