i have a textbox where i get numbers by looping...i get 1,2,3,4,12,345,32 and 67..
but i get only 67 in textbox..i want to add all the numbers and display the result at the end...
I am trying to loop through 10 textboxes (TextBox1 to TextBox10), which are located in a Tab (TabPage1), and clear their values.I have written this code which doesn't seem to work:
Dim i As Integer For i = 1 To 10 If TypeOf Me.TabPage1.Controls(i) Is TextBox Then Me.TabPage1.Controls(i).Text = "" End If Next i
i know there are no "control arrays" in vb.net. i do come from vb6, and im trying my way now within bv.net, so please be gentel...
if someone could please post a simple code to do the following, it would be great:
i have 3 textboxes called txtBet1, txtBet2 and txtBet3.
i have another 3 texboxes called txtResult1, txtResult2, txtResult3.
so i want to have one loop code, to get the value in txtBet1, calculate somethings, and put it into txtResult1.text.
i know it's basic, but i tried using this sample here as a reference, but its not really understandable for me, because its not really choosing the exact control i want to address...
this is from Microsoft website - a comparison between vb6 and vb.net:
"' Visual Basic 6.0 Private Sub ClearText() For i = 0 To Text1().UBound
For Each control2 As Control In GroupBox3.Controls If TypeOf control2 Is TextBox Then Dim txt2 As TextBox = TryCast(control2, TextBox) If counter > totalBoxes Then
[Code]...
What I am doing is looping through each textbox in groupbox3. Then checking if the counter(total number of grades that are inputted in the form) are greater than the totalBoxes(which is set to 0) and finally I am putting the actual grade(A,B,C,D) into the textbox. The problem is that it is starting the loop at textbox 8(I have 10 textboxes) for some reason and going from there. Does anyone know what the problem is with my code?
I have a number of textboxes in my program, and a few other controls with text in them.I want to loop through a select number of textboxes (1-10 in this case, for testing), and output their combined data into a string.Here is what I created, with the help of someone on this forum earlier.[code].....
I have a form with 24 textboxes incremented by a letter. example: txtDimVala1.text, txtDimValb1.text, txtDimValc1.text, etc. I created a code to check each textbox, but there must me a more efficient way to loop it. I have tried a few loops but I cant get them to work looping through the different textbox values.
I am trying to loop through my repeater control and get the textbox values.However, I am getting an error: {"Object reference not set to an instance of an object."}
my code is:
Dim txtField As TextBox Dim j As Integer = 0 'Confirm if user has entered atleast one quantity For Each item In rptRequestForm.Items
I'm trying to loop through a bunch of checkboxes I have created on my aspx page. I would like to get all the values, and parse them to a string to send to another page as post variables. This is what i have so far:
aspx.vb file: Protected Sub Submit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Submit.Click Dim targetURL As String targetURL = "report.aspx?" ' This is the part i can't figure out. ' For Each checkbox on page 'if checkbox is checked 'targetURL &= checkboxid & "=true&" End Sub
My goal is to build another page that will then check these values using Querystring variable, and build a listview out of them. (a report page, that basically lets the user select checkboxes of the columns they want to see on the report).
I have been out of the VB game for awhile and am now trying to catch up to VB.NET. I know my current solution probably has a more efficient way of doing what I want, such as using LINQ or something. But, I am start at the bottom and working my way up. I essence I have 1 table controlling which columns get added to a working string, that I will eventually export into a text file. My first table has 3 columns(ID, String, Processed). The ID is the index or primary key and the string is the data I need, and Processed tells me if I have extracted that string yet or not( 0 for no and 1 for yes)...
My main problem is checking values in table 1 where I need to add the string. Of course my problem might be deeper in how I am even returning the values from the datatables.
Code:
Partial Public Class StoredProcedures <Microsoft.SqlServer.Server.SqlProcedure()> _ Public Shared Sub StoredProcedure1()
Currently I have a problem with updating my database with values in my Data Grid View.
On my form I have a "Populate" button and "Submit Details" button.
The "Populate" button fills my Data Grid with numerous lines of data.
On the click event for "Submit Details" I want this data to be inserted into a table in my DataBase by looping through each record.
For Each dgi As DataGridView In DataGridView1.Rows
Dim productCode As String = DirectCast(dgi.FindControl("product"), Label).Text Dim description As String = DirectCast(dgi.FindControl("description"), Label).Text Dim quantity As String = DirectCast(dgi.FindControl("order_qty"), Label).Text
I need to find a method of looping through a listbox and retrieving the index number and values - quite straightforward in asp, but turning out to be something of a nightmare in winforms!Here is the scenario - The user can add values in a textbox, that are in turn added to a DataTable that gives it a unique ID and a row number, this is then bound to the listbox. The user can then move the items up or down the list by adjusting the row number in the datatable and rebinding to the listbox..
The problem that I am hitting is when the user needs to delete an item -the first part is easy - delete from the DataTable and rebind to the listbox. The bit where I hit the proverbial brick wall is needing to loop through the listbox rows and getting both the index number and the ValueMember - that way I can change the row numbers in the DataTable based on the index number against the ID number.
Im just wondering if some one can take a look at my insert statement, as is not working,
Im trying to add values to SQL from 4 textboxes. Public Sub Insert(ByVal textbox3, ByVal textbox4, ByVal textbox5, ByVal textbox6)
Dim conn As New SqlConnection Dim comm As New SqlCommand conn = New SqlConnection("Server=Scott-VaioSQLSERVER;Database=Testing;Trusted_Connection=True;") conn.Open()
i am having trouble with the inserting of new values though the textboxes. it gives me the error Syntax error in INSERT INTO statement., OLE DBEXCEPTION was unhandled at da.Update(ds,[code]
I have 10 text boxes and I'm trying to create an array to store the values entered by the user, I then need to add the totals of all of them, get the average, highest and smallest of all the 10 values entered by the user?
Public Class frmNumberAnalysis Dim tbArray(9) As TextBox Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
I started editing an existing code (basicaly to learn vb) without any real previou experience. Well let's get to the point; I have a form that gathers data from db ordering by user ID (on click count). I have one DataGridView with a list of user, some have data in db, some have not. I came so far that if I CLICK on a user that have data, all data is dissplayed in 6 dinamyc textboxes. If user has no data inly first (emty) row with 6 dinamyc textboxes is created.
Then I have a button that simultaneously adds a row of dinamyc textboxes bellow and multiplyies textbox04 (name is clickcount & 4) and textbox05 and displays the result in textbox06. I want to add a messagebox that shows if textbox04 & 05 are empty and in that case exits sub. Of course if they are not empty, their sum should be multiplyed in textbox06 (on 2 decimal places exact) Here is my code so far:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Reset warnings
I have 2 textboxes where the values are filled with this code(the data is collected from 2 different
[Code]...
When I now tries to update the data in the box743 i get an error. Who says that I can not convert the strng to double.I use the tableadapter to update the database and both box498 and box518 updates without problems.But when I try to upgrade the 743 box I get the error.
if i have 10 textboxes on my form with numbers inside 5 of them have the number "0" other 5 lets say 100 50 40 30 10 i need to get the smallest value but not the "0".
I have textboxes which is placed inside accordian (ajax control).In pageload event i have written the code to load values in textboxes. But onload event one error is coming as object not set to instance of a object. Values are not coming in textboxes. Then i tried to initialize controls in textboxes .Then the error cleared. But Values are not coming in textboxes. What may be the reason for this?
If i have multiple textboxes with the same Id and name in a form, how to fetch there values separately in vb.net? in javascript iv used fetched them like this
if textbox1.text =S1, S2 then on button click event the S1 and S2 column value of Table in MSSql2005 database will be updated with the value "b" where date=1/3/2012
i have a question on how to add two values of placeholder on different forms. in the forms i put a placeholder for "correct answer" and "wrong answer" so one of this placeholder will have a value of integer. how can i add a value on the first form to the other placeholder of the other form.
I am currently building a mortgage application and currently have two forms, the way the system works so far is the user selects an option from a series of radio buttons whilst a score is kept based on the options chosen, this is then displayed in a text box to the user, on the second form there are more choices, and a textbox to display the final score, what I can't figure out is how to get the value from form one to the textbox on form two when the user clicks next on form1 to get to form 2.
How do i get data from a database and put it in to multiple text boxes?Basically i have abilling form with; name, address, etc.But i have a 'retrieve' function underneath which allows a name and post code to be entered and then the information above is automatically filled in if the name and post code exists. At the moment i just setup a connection with the variables. not sure how to do the rest
objCommand.Connection = objConnect objCommand.CommandType = Data.CommandType.Text objCommand.CommandText = "SELECT CustomerName FROM Customer WHERE CustomerName = @CustomerName AND PostCode = @PostCode"
This is my first time joining a site like this and I'm trying to learn vb .net. Im very new to the concepts and this was my last resort because I cant find the answer im looking for. Below is my code, and all I want to do is display the calculated resaults in a summary. Weather it be a message box or a diffrent form it really doesnt matter.[code]...