Calling A Button With A Variable?
Aug 15, 2011
I'm trying to call make visible an object, i can do this:
Button1.Visible = True
but, i was wondering if there is a way that i can call it like this. Lets say i have a variable 'OBJNAME' wich value is "Button1". What i want to do is to make visible the button like this:
OBJNAME.Visible = True
I want to do this because i have like 100 objects to show in the form and i dont want to code for every one of them.
View 3 Replies
ADVERTISEMENT
Aug 23, 2009
I believe there wont be any diff if user clicks the button on the form and the click event is fired OR if we call the button click event / function in the code. Because in one my project, this does make diff. If I click the button on the form, the App works great but same button if I click it thru the form code, the whole process crashes. This happens in Vista / VB.net.
View 12 Replies
Jun 25, 2010
i am currently trying to re-write an old VB6 program into .net basically the program contains 100's of forms for different jobs each with a Public Sub runjob(). the form names are then stored on a database. the user then selects the job from the listbox and it calls the correct job.the code i use to use in vb6 was
sValue = database.rsselectjobrun.Fields("callname")
Set frmName = Forms.Add(sValue)
frmName.runjob
Set frmName = Nothing i have looked into it and found this code which calls the form in .net
Dim objForm As Form
Dim sValue As String
Dim FullTypeName As String
[code]....
but i cannot get this to run anything other then the formload code. i know i can put all of this into a select case module but id rather not with the amount of forms i would have.
View 4 Replies
Oct 8, 2009
I have datagrid in which the 0th column has ID. What i want is while clicking on the datagrid the id of the particular row has to be load in the variable in the second form. For this i have created a public variable in the second form [code]but here its not returning any value to EditID while loading the second form.
View 1 Replies
Sep 3, 2009
I have a form with a list box. I'm calling it as a dialog. I can get the result of which button was pressed (OK/Cancel) but how do I get the value chosen from the list?
Dim frmCreateCSVFile As New CreateCSVFile
frmCreateCSVFile.dtpFirstEndDate.Value = dtpFirstEndDate.Value
frmCreateCSVFile.dtpLastEndDate.Value = dtpLastEndDate.Value
[code]......
View 1 Replies
Jul 9, 2009
Is there a way to call or pass a variable to another sub? I'm trying to reterive a variable (or even a field name) in somethign like this:
Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
args.Graphics.DrawString(RS("field1"), New Font("arial", 8), Brushes.Black, 5, 5)
[Code].....
View 6 Replies
Jul 5, 2009
in vb I can do that
sub SetFocusControl(byref ctl as object)
ctl.Focus
end sub
in c# the compiler complaint that object doesn't have a Focus method
void SetFocusControl(ref object ctl)
{
ctl.Focus();
}
how can I do the same in c#?
View 3 Replies
Aug 29, 2011
How can I access the values stored in a session object with a class in asp.net?
View 3 Replies
Feb 24, 2011
I want to call the class radiostate by a button click on a form..Is this possible.. or should I rephrase it to say I want to call a function inside a class... either way im stuck.
View 3 Replies
Jun 3, 2011
i have cracked my brain to figure out on how to use if else statements in form1 to call button.click from another class.
View 14 Replies
Apr 19, 2012
I have two button as shown below:
1st Button:
<asp:Button ID="btn1" runat="server" Text="First Button" CausesValidation="False"
UseSubmitBehavior="False" />
[Code].....
View 3 Replies
Jun 3, 2011
Im trying to create a webform that is a representation of a paper questionnaire that has 14 questions with yes/no answers. If an answer is no, then you must provide information as to why in 3 separate textboxes and store the information only when a user clicks no.I also have 4 drop down lists that are chosen before the user answers the first question that also need to be stored with the textboxes, but the ddl's value does not change after the user starts. Right now I have 3 textboxes and a submit button for each of the 14 questions that are hidden until a user hits a "no" button, in which I change the visible property of all of them and the user then types in their reasons and submits the answer. I am currently doing this for each question and i hide/disable the textboxes and button after submitted.
My problem is that for each event on the 14 submit button's is that I'm forced to open & close an sql connection and insert the values. I know there has to be a way to simply this some so that I dont have 14 different groups of the same code. I would also like a way to eliminate having 40 textboxes on a page lol, because the idea was to have a pop up box or something open that would let the user submit it and then return to the question instead of hiding textboxes, but the user has to see all 14 questions at page load so if you got an answer to that one then that might solve my original question.
View 1 Replies
Feb 28, 2011
I have a slight problem, i have a Wages file, a File that is linked to other file. (Employees)
The user can Input the EmployyeeID and click the button, this will display that record with that ID.
When i save the PayFile, i want ONLY to save the Employye ID. When i come to search the PayFile, how could i get it so that it displays the Employee's ID without clicking the Search Employee button??
View 2 Replies
May 25, 2010
I have 2 forms FORM 1 and 2 i got this code in form 1
vb.net
Private Sub starauto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles starauto.Click
form2.Button1.Value = True
form2.Button1_Click()
End Sub
but both examples give me an error
error 1.- 'Value' is not a member of 'System.Windows.Forms.Button'.C:Documents and SettingsleijaiMy DocumentsVisual Studio 2008ProjectsIp On or OffIp On or Offform1.vb239Ip On or Off
Error 2.- Error3Argument not specified for parameter 'sender' of 'Public Sub Button1_Click(sender As Object, e As System.EventArgs)'.C:Documents and SettingsleijaiMy DocumentsVisual Studio 2008ProjectsIp On or OffIp On or Offform1.vb249Ip On or Off
error 3.- Error2Argument not specified for parameter 'e' of 'Public Sub Button1_Click(sender As Object, e As System.EventArgs)'.C:Documents and SettingsleijaiMy DocumentsVisual Studio 2008ProjectsIp On or OffIp On or Offform1.vb249Ip On or Off
View 6 Replies
Jun 1, 2011
While studying sample code for vb.net, I put the code in a button click event and need to click the button to see the results. It would be nice to have this code run by adding Button1_Click() to save time but I get an error because of the parameters needed for the Click event.
I get a suggested "Generate Method Stub for Button click event" which is probably a clue to the problem if I had any idea what that means.
View 13 Replies
Mar 29, 2009
I don't know how to make button1 call the combo box Items to do a conversion calculation for the following:
From To Conversion
Miles Kilometers 1 mile = 1.6093 kilometers
Kilometers Miles 1 kilometer = 0.6214 miles
Feet Meters 1 foot = 0.3048 meters
Meters Feet 1 meter = 3.2808 feet
Inches Centimeters 1 inch = 2.54 centimeters
Centimeters Inches 1 centimeter = 0.3937 inches
Attached is the Form that I am working oo
Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
ComboBox1.Items.Add("Miles to Kilometers")
ComboBox1.Items.Add("Kilometers to Miles")
ComboBox1.Items.Add("Feet to Meters")
[Code] .....
View 1 Replies
Mar 22, 2011
i created a function procedure and i need to the action to be carried out when i click a button, but a don't know how to call the function procedure under the click event of the button control.
View 1 Replies
May 22, 2012
I have one tabstrip control having two tabs. On one tab i have Panel control where i have showed another form and this other form have one button "Submit". On other tab i have some controls and one button "OK". Now on clicking "OK" button i have to call the click event of "Submit" button of the form on panel on other tab. All this is in windows application in vb.net.
View 1 Replies
May 11, 2012
I 'm trying to achieve is have 1 button that toggles between 2 batch files start/stop - when pressed the button calls for a batch file to start process - then if pressed again it calls for another batch file to stop the process. But it would be hand to have indicator or text on button stating the status.
View 1 Replies
Apr 7, 2011
I am messing around with some Excel Automation just to get my feet wet and want to call some specific cells in my spreadsheet just for testing. I have one form in the project including a button. My question is how do I tell the button where to navigate to the cell to be tested?
My code for my Excel class is as follows:
Public Class Waybill
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oExcel As Object = CreateObject("Excel.Application")
Dim oBook As Object = oExcel.Workbooks.Open("C:\TesterXL.xls")
[Code] .....
View 6 Replies
Jun 3, 2011
is it possible to call form load event on button click
Following is the vb code i want same function in vb.net
Private Sub cmdaddcancel_Click()
Form_Load
[Code]......
in vb we simply call Form_Load is it possible in vb.net
For eg: IN VB.net currnetly i am on form no 1 and there is one button on click of dat button i want the current form should again load is it possible
View 1 Replies
Feb 17, 2011
I'm currently working with a client's VB.Net code, which was developed for them by a small development shop a few years ago and which they purchased and have been maintaining and uprgrading since. This client's primary developer is out on indefinite (likely permanent) medical leave and I'm now filling in until they bring in a full timer (as I'm a contractor here). My current task is to add some functionality to a the VB.Net code they purchased. I'm finding practices and techniques in the code that absolutely baffle me and can't make the code do what I want. I'm starting to wonder if it's me and was hoping to get some thoughts on the code I've encountered.
For example: Setting a variable to accept the result of a function by calling the function with many parameters, clearing the parameters in the function, setting them to some value, calling another function with those new values, then never using the values returned by the functions. I'll add a code snippet in the first comment since this is already getting long.
View 9 Replies
Apr 30, 2009
I have a form with tons of buttons on it. each button has a corisponding entry in a database. What I am trying yo do is change the colors of the buttons depending on the data in the database. I can read the data from the data base fine. here is what I have: the button names are as such: button & the plutnum
while not rs.eof
plotnum = rs("plotnum")
plotcolor = rs("plotcolor")
me.(button & plotnum).backcolor.(plotcolor)
[Code]...
View 16 Replies
May 27, 2010
I have an app that has a lot of buttons. Once a user clicks a button it runs a subroutine. I need to pass the button name to the subroutine and then update that buttons text property to a variable.
View 18 Replies
Nov 18, 2009
I am working on an alarm system software, which is SMS-based. I am using a GSM modem to receive the SMS when a client's premise security devices are triggered. The types of SMS text received will be like for e.g. "fire alert"(when devices triggers), "fire clear"(when devices are 'reset').
My program can detect real and false alarm, it works this way, i will input a premise site-map on a picture box at the main GUI, i can then create buttons at run-time and drag them to the respective position on the map. The buttons created have their text set as the client's block number referred to the database. So basically, a button represent a client. When a device in the client's premise is triggered, a SMS will be sent and my GSM modem will receive it, process the SMS and the button representing the client will start 'flashing' showing that the client's premise is under danger. Then when the button is clicked, which acts as an acknowledgement, will display the client's information on labels and turning that specific button to red color. Finally, when the device is 'resetted' in the client's premise, it will send another SMS to my GSM modem, after processing, the button will be back to normal.
But my program has detect false alarms also, the first part is similar to mentioned above, client's premise security device triggers, SMS sent, SMS received by GSM modem, process SMS, button 'flashing'. Secondly, if the alarm is false, it will be automatically 'resetted' or the client may 'reset' it, then a SMS will be sent to my modem, turning the button to 'flashing' green in color. when 'acknowledged' will display the client's info and the button will become normal.
The problem here i am facing is during the processing of the SMS, because the real and false alarms both will receive the 'clear' SMS when during some stages, but the functions are different and of course the 'checking' for both functions will be different too. The problem occurs at the checking process whereby the 'btn' variable is not detected.
'Try
'AT commands to receive SMS
serialPort.Write("AT+CMGL=""REC UNREAD""" & vbCrLf) 'set command message format to text mode(1)
[Code]....
View 1 Replies
May 22, 2012
this is the linkbutton
<asp:LinkButton runat="server" ID="linkId" OnClick="doSomething(10)">ID
</asp:LinkButton>
and this is my sub
[code].....
View 2 Replies
Jun 11, 2009
I need to set a variable , say Flag=1 when a button is clicked.
How do i set the Flag=1 and this variable can be used in OTHER application? Meaning this Flag is set in Program A, then Program B will use this variable (always updated value). I wrote application in VB.NET.
I think app.config isn't that good (use the add key="" value "" ) because when program is executing, it will lock the app.config file.
This Flag variable will be changed according user input (button click) and i try to make this variable use across other application. How to do this?
View 4 Replies
Apr 26, 2012
I have the following radion button in VB.NET
<asp:RadioButtonList ID="rbedit" runat="server" RepeatDirection="horizontal" >
<asp:ListItem Value="1" >Yes</asp:ListItem>
<asp:ListItem Value="0" >No</asp:ListItem>
</asp:RadioButtonList></td>
I need to figure what button the user clicked on and then set a variable with that value.How would I go about doing this?
View 2 Replies
Aug 26, 2010
I want to have the browser to be directed to a certain url upon button click with the text inserted into the textbox place into the url. For example - [URL] No this isn't what I'm trying to do, but it gets the idea through.
View 1 Replies
Sep 27, 2010
Is it possible to detect when any button on a form is clicked and then store that buttons name in a variable?
My reason for wanting to do this is because i have over 700 buttons in my form and each one needs to do something different. I want to create one sub with if statements to respond to all button clicks.
View 17 Replies