|
The answer remains the same, the "sender" object is what was clicked. Evaluate the name you gave the menu item or set it's Tag property and look at that.
|
|
|
|
|
Each menu item can have methods that are triggered upon selection. If I have a popup menu (aka context menu) with three items: "One", "Two" and "Three" and I select menu item "Two" from the menu then my program will receive a "Two_Clicked()" event. You need to trap that event in your program and then (possibly) call your own generic handler from that event. That way you always know which item was selected.
...Steve
|
|
|
|
|
I have a handler for a context menu
Public Sub MyHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
|
|
|
|
hello everyone,
i would like to code an application that can simply answer a call using the modem and log which keys (or in other words which dtmf commands are sent) are pressed. it's something i have never worked into so i am in need of help. through several web sites i've checked into this but the results i got (sample codes or articles) were not satisfactory. so if someone could feed me a sample that can simply log the buttons pressed by the caller or an address of an idiotproof article that would be useful i would be really grateful cause i simply couldn't figure out where to start. can there be a basic method of processing such commands from a modem, non-dependent of the chipset or does it have to vary with every different model?
thanks
|
|
|
|
|
This is done through TAPI (Telephony API). The problem is that not all modems support this and there is no standard classes in the .NET Framework that wrap TAPI. You have to use a third party library the supports this. The problem here is that not a libraries completely wrap the TAPI API's. There are also multiple versions of TAPI, each with it's own feature set that it supports.
THe bottom line is that there is no "idiotproof" article that explains al this. The topic is just too broad. You'll have to do a bunch of reasearch on the support you need, then find a library that wraps the sections of the TAPI API that you need, and, hopefully, that library will come with documentation on how to use it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What is work with this?
If Me.txtClientId.Text = "" Then
Me.CheckBox1.Value = False ' unchecked
Else
Me.CheckBox1.Value = True ' checked
End If
|
|
|
|
|
There's nothing wrong with the code itself, where the code is may be of more relevance. If this code is in your checkbox1 click event it may generate an infinite loop. More information on which language you're using and the type of problem or the type of solution you're needing would be helpful
Note: For VB6 the .Value property is not a boolean as the option button is, it may be one of three values: vbChecked, vbUnchecked or vbGrayed.
|
|
|
|
|
I wanted to import an info. from Excel (worksheet.range("A40"), for example. Let say, if this cell is blank, a check box remains unchecked. If this cell contains something, I want a check box to be checked. Thank you so much.
|
|
|
|
|
Assuming that an empty cell is the same as "" then change your " = True" to " = vbChecked" and your " = False" to " = vbUnchecked".
|
|
|
|
|
It still does not work..... it just grayed out
If Me.txtClientId.Text = "" Then
Me.CheckBox1 = vbUnchecked ' unchecked
Else
Me.CheckBox1.Value = vbchecked ' checked
End If
|
|
|
|
|
Try enabling the control!!! You've also left off the ".Value" in the first Checkbox1 assignment. Also check that .Text comparision is valid. Maybe this should be .Text = vbNullString ???
...Steve
|
|
|
|
|
are you working under Vb.net? or Vb 6.0
i think you just write this as
If Me.txtClientId.Text.length >0 Then
Me.CheckBox1.checked = true ' checked
Else
Me.CheckBox1.checked = false ' checked
End If
I am Entry level person
|
|
|
|
|
Upgrading VB6 to .NET has been so pleasant.... NOT
In VB6 I could make a control array, when an operator clicked on an element I could set a variable that told me which control it was then I could pop up a menu where the user selected a menu item. When they did I looked at the control they were pointing to and did what I needed to do. (I have 100+ slots and the user needs to be able to look an a particular one, each of which is represented as a label or text box on screen)
OK in .NET, no control arrays, so I build 100+ controls manually, then I arrange them on screen (each configuration could be different), once again hundreds of lines of code as there are no arrays, then I try to trap the one clicked for the popup menu, my next joy has arrived....
I was hoping that someting like this would work:
Private Sub lblSlots5_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSlots5.Click
g_selectedslot = 5
End Sub
The hope being I would set g_selectedSlot before the menu pops up... for some reason it does not seem to work that way.
Yes, I did try MouseHover and MouseDown.
any ideas?
Thanks in advance, the rest of my bottle of Advil to anyone who can help...
|
|
|
|
|
I'm new to .NET myself after years of VB programming (4 and up) and that's my biggest complaint about .NET is the events appear to be fired in a really haphazard fashion (my personal biggest pet peeve is Form_Load may or may not be the first event to fire).
You can create one event to handle all of the mouseclicks by adding them to the event:
Private sub MouseClick(Byval sender as...) handles lblSlot1.Click, lblSlot2.Click, lblSlot3.click, ...
MsgBox("Label Clicked = " & sender.Name)
End Sub
Personally, I would ask someone here show you how to create controls at run time and assign them to an event handler, I'm a little fuzzy as to how to do that myself.
|
|
|
|
|
control array:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim poLbl() As Label<br />
Dim piIndex As Integer<br />
Dim piX As Integer<br />
Dim piY As Integer<br />
<br />
ReDim poLbl(5)<br />
piX = 10<br />
piY = 10<br />
For piIndex = 0 To 5<br />
poLbl(piIndex) = New Label<br />
poLbl(piIndex).Parent = Me<br />
poLbl(piIndex).Height = poLbl(piIndex).Font.Height<br />
poLbl(piIndex).Left = piX<br />
poLbl(piIndex).Top = piY<br />
poLbl(piIndex).AutoSize = True<br />
poLbl(piIndex).Text = "Dynamically Created " & piIndex<br />
poLbl(piIndex).Visible = True<br />
poLbl(piIndex).Tag = piIndex.ToString<br />
AddHandler poLbl(piIndex).Click, AddressOf ClickHandle<br />
piY = piY + poLbl(piIndex).Height + 5<br />
Next<br />
End Sub<br />
<br />
Public Sub ClickHandle(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
MsgBox("Clicked #" & sender.Tag)<br />
End Sub
|
|
|
|
|
Perfect, now if I can just figure out the menu thing... thanks
|
|
|
|
|
Hello,
I am tring to return a employee object to my GUI Page from a dataaccess page. Every thing seems to do fine until the function try's to return the employee object from the Ordional Postion of (0) from the EmployeeList Innerlist. I am getting stuck on the GET and the Return CType(Me.Item(index), Employee) . Wehn i step into the code It just goes back and forth like it is stuck or something. Like a broken record.. And when i just run the application i get an error message that there is a overflow error.
Can someone please look at this and let me know where i need to make chages?
I can post all of the code if i need to..
Thanks,
Erik,..
If you will look below; this is where i am tring to return the employee object
Default Public ReadOnly Property Item(ByVal index As Int32) As Employee
Get < ******Stuck here********
Return CType(Me.Item(index), Employee) < ***** AND HERE
Gui....................................
Dim EmpAss As New EmployeeAccess
ddl.DataSource = EmpAss.PopEmployee(2)
ddl.DataBind()
------------------------------------------------------------
DataAccess-----------------
Public Function PopEmployee(ByVal Empid As Int32) As Employee
PopEmployee = GenericDataAccess("Employee_Byid", "@Employeeid", Empid)
End Function
'
'
Dim Emp_Data_List As New EmployeeCollections
Private Function GenericDataAccess(ByVal CommandText As String, _
ByVal ParamName As String, _
ByVal ParamValue As String) As Employee
With Data_Connection
.Open()
End With
'
With Data_Command
.CommandText = CommandText
.CommandType = CommandType.StoredProcedure
With Data_Command.Parameters
.Add(ParamName, SqlDbType.Int, 4).Value = ParamValue
End With
.Connection = Data_Connection
End With
'
Data_Reader = Data_Command.ExecuteReader
While Data_Reader.Read
Emp_Data_List.Add(New Employee(Data_Reader("FirstName"), _
Data_Reader("LastName"), _
Data_Reader("City"), _
Data_Reader("Employeeid")))
End While
With Data_Connection
.Close()
End With
'
With Data_Reader
.Close()
End With
'
With Data_Command
.Dispose()
End With
'
Return Emp_Data_List(0)
'
'
End Function
===================================================
CollectionBase---------------------------------
Public Class EmployeeCollections : Inherits CollectionBase
Public Function Add(ByVal Employee As Employee) As Int32
Return Me.InnerList.Add(Employee)
End Function
'
Default Public ReadOnly Property Item(ByVal index As Int32) As Employee
Get
Return CType(Me.Item(index), Employee)
End Get
End Property
End Class
|
|
|
|
|
i m using wmi to connect my pc to remote comp.
but getting an error. Access is denied .
pls help me out!!
thnx in advance
// code of connecting PCs is as folows..
Dim objWMIService As ManagementObjectSearcher
Dim colQuotas As System.Management.ManagementObjectCollection
Dim objQuota As System.Management.ManagementObject
Dim path As ManagementPath
Dim scope As ManagementScope
path = New ManagementPath(String.Format("\\{0}\root\cimv2", "192.168.1.110"))
scope = New ManagementScope(path)
Try
scope.Connect()
Catch ex As ManagementException
' Failed to authenticate properly.
MsgBox("Failed to authenticate: " + ex.Message)
' Return Status.AuthenticateFailure
Catch ex As System.Runtime.InteropServices.COMException
' Unable to connect to the RPC service on the remote machine.
MsgBox("Unable to connect : " + ex.Message)
'Return Status.RPCServicesUnavailable
Catch ex As System.UnauthorizedAccessException
' User not authorized.
MsgBox("Unauthorized access: " + ex.Message)
End Try
objWMIService = New ManagementObjectSearcher(scope, New ObjectQuery("Select * from Win32_ComputerSystem"))
colQuotas = objWMIService.Get
For Each objQuota In colQuotas
HostName = objQuota.GetPropertyValue("Name").ToString()
Next
*AnNiE*
|
|
|
|
|
hi there,
Take a look on this link
WMI
this might give u a hint...
<< >>
|
|
|
|
|
does anyone know how to resize the graphics objects (rectangles, ellipses etc...) after the user creates them ? preferrably with a standard handle container....
|
|
|
|
|
codecreeper wrote:
preferrably with a standard handle container....
sorry, wat do u mean here?
u mean that u want to do something like a Paint program in which user can draw some objects (rec, ellipse,..) then he can resize these objs?
if so, the way to achieve this that u have to store these objs in an array. Then u hv to repaint these objs if user resize...
<< >>
|
|
|
|
|
Yes by creating the reize method.Contact me for further assistance
Hi i am sumod
|
|
|
|
|
Is anybody developing apps/components that are OPC compliance. I just wanted to know if OPC is still alive and it's used as standard for industrial client / server applications.
Marc Soleda.
P.d: I've asked the same question in the VC++ forum but as it can be applied in any development platform I decided to ask it here.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I am very carefull about declaring variables. But in a project i get out of memory exception, generally after close a form i use GC.Collect.
In this project , I connect a Sql Server with a sqlConnection declared as public in a module. Because in every task, i use this connection object. Before task i open that, when i achive the task, i close the connection. can This be cause?
|
|
|
|
|
Greeky wrote:
Before task i open that, when i achive the task, i close the connection. can This be cause?
Nope, I think.
To easily figure out somthing. U might post ur snippet code that cause this problem. Or u might try to debug it.
<< >>
|
|
|
|