|
|
How can I do the following, that is recgonise that I have click on a certain button so to do something.
e.g.
Private Sub BasicValidation(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click
if I click on Button1.Click
Do Something
else
I have click Button2.Click
Do Something else
End Sub
|
|
|
|
|
In the function definition, sender is passed as a parameter. Sender is actually the control that is clicked. It is of type control, not button though. So you can test sender:
If sender.name = "button1" then
' do stuff
ElseIf sender.name = "button2" then
' b2 stuff
End if
If you added the controls at runtime then you won't might not have set the name property, in that csae the quick way is to set the tag property to something as you create the controls and then test sender.tag.
|
|
|
|
|
for example, I have a command-line app uharc.exe and I want my vb.net app to give it this command:
UHARC a archive *.dll @c:\list *.exe
Regards,
Vykintas
|
|
|
|
|
|
Thanks a lot.
Regards,
Vykintas
|
|
|
|
|
I am finished with designing and implementing a mail server using VB6, now it works using the LAN, but it dose not recognize any other mail servers, like yahoo, or hotmail..
How can i make it do this
Regards
SS
|
|
|
|
|
hi guys i am newbi in VB.NET. I am having tables in access database and i want to take data for multiple employees. so i want to do this in DataGrid so user can easliy enter for multiple employee. I can show data from a table to a datagrid now how to update the same table as per the changes made in datagrid.
Also i want to know can we fill a table with a query in access?
Darshan Shah
|
|
|
|
|
Hi - welcome to code project, and programming in general ( well, VB anyhow ). What you're asking here is a common problem, which has been described in detail on hundreds of web pages. There's this site called google, http://www.google.com[^]. You'll find that if you pursue the world of programming, you'll use it a lot, because there are always new things to learn, and they are all just a google away. Of course, once you've done this and tried the examples you find online, you may still have more specific questions or problems, that's where message boards like this one come into it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Does ctl exist at this point ? Does it need to be initialised ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Garrett Klas wrote: Private sub Example()
Dim ctl as ctlExample
Dim iFontSize as integer
iFontSize = ctl.Fontsize <-- Throws Object/Variable not set Error
End Sub
ctl is not initialised. All you have done is reference it. You need Dim ctl as new ctlExample, or a Set ctl = new ctlExample at the start of the routine.
Having said that, the control, assuming it is a User Control, should be sited on a form. Just accessing the control in the manner you show probably won't do anything as it would be creating a new instance of the control and I am not sure where it would be. You really need to access the control where it is sited i.e. 'Form1.ctlExample.FontSize = x' again assuming that you have a property called FontSise exposed in the control.
-- modified at 6:19 Thursday 10th November, 2005
|
|
|
|
|
|
OK, I hope I am understanding you correctly.
Al you need to do is to set the variable in the class to the font size. You do not need to reference the control at all.
[In Class Pane]
Public FontSize As Integer
etc
[In User Control]
strIndex = Panes.Add(??? variables if you have them)
Panes(strIndex).FontSize = UserControl.FontSize
I don't have VB6 with me but if this doesa not help can ive you a fuller example tomorrow.
-- modified at 3:09 Friday 11th November, 2005
|
|
|
|
|
how to display a emerging window before printing by vb
can you helpme please
thanks a lot!!!
|
|
|
|
|
I'd say the reason you got a 1 vote is that no-one can understand the question. You want to show a dialog box before printing ? A print dialog, or a dialog you wrote yourself ? In VB6 or VB.NET ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
When I get registry Values in VB.Net there is no problem unless the Value has a space in it. I have tried parenthesis, tick marks, removing the space, referring to it by index, using underscore in place of the space....
This one works:
Bob = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DDM\Device.1", "ModelName", "Empty")
This one does not work:
Bob = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DDM\Device.1", "Rom version", "Empty")
The problem is the space in Rom Version.
Any Ideas?
Ken
|
|
|
|
|
I've never had a problem with it getting a value who's name has spaces in it.
I would suspect that the problem is more with the registry value type though. What registry type is this "Rom Version"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You know, I think your right on the money. the two value i have no problem getting are text strings. this one is 4 bytes (52 39 30 32) that when converted to their ascii values = R902, which is right, that is, it is the correct firmware for that drive.
The error message does say - "Conversion from type 'Byte()' to type 'String' is not valid." and
"When casting from a number, the value must be a number less than infinity"
It may just be a coincidence that the Valuename has a space in it and the two the worked did not.
I was planning on getting the value and converting it to ascii.
Thanks for your help!
Ken
(Inventor of the Batch File that will replace VB.NET)
LONG LIVE DOS!! you remember...dos.
|
|
|
|
|
I declared a variable as type Byte and tried that. It said cannot convert from type byte() to type byte which really kinda stumped me. Then I saw that it was an array of bytes (?), right? so I added () to the variable declaration and it works!
Sound right to you or am I going at it completely wrong?
Also, I have to convert these 4 bytes to ascii characters. I'm sure I can figure it out , but do you know of any conversion tools in vb?
Thanks for putting me on the right track!!
Ken
(Inventor of the Batch File that will replace VB.NET)
LONG LIVE DOS!! you remember...dos.
|
|
|
|
|
Ok, I got the ASCII thing too using bob=chr(regvalue(0)).
Thanks again
Ken
(Inventor of the Batch File that will replace VB.NET)
LONG LIVE DOS!! you remember...dos.
|
|
|
|
|
Hello,
I have a set of checkboxes created on a windows form. The state of these need to dynamically set when the form is loading depending on the data coming from the database.
I have tried to use the checkbox.checked and checkbox.CheckState to set the state of the checkboxes, but the state doesnt seem to be remembered. Code as below:
<br />
<br />
ElseIf shelterV.Equals("Quiet South Shelter") Then<br />
selectedShelters.Text = selectedShelters.Text & "Quiet Shouth Shelter" & vbCrLf<br />
log.Message = selectedShelters.Text<br />
log.Category = "Trace"<br />
Logger.Write(log)<br />
QSChkBx.Checked = True<br />
QSChkBx.CheckState = CheckState.Checked<br />
Can anyone please tell me how to set these?
Thanks
|
|
|
|
|
What you're doing is right. There must be other code which is setting the states again.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
mitli wrote: QSChkBx.Checked = True
I think this should read: QSChkBx.Value = vbChecked
...Steve
|
|
|
|
|
Steve Pullan wrote: I think this should read: QSChkBx.Value = vbChecked
Oops... I had a relapse into VB 6.0 Sorry.
...Steve
|
|
|
|