Method To Append Results Of For Loop In Variable While Running?
Feb 8, 2012While a "for loop" is running in VB.net, C# or Python which method can be used to append each result to a variable?
View 2 RepliesWhile a "for loop" is running in VB.net, C# or Python which method can be used to append each result to a variable?
View 2 RepliesI am coding a simple calculator and I need the textbox to show the previous entries when I enter them. I hear the best way to do this is by Append Text? For example I click 3 Then + The textbox will show "3+" etcetera.
View 1 RepliesI'm a newbie writing my first app. I need help with the following: I need to retrieve the logged in user which = GID, I then need to append it to a URL which will start our Help Desk chat client. I can retrieve the GID easy enough but can't figure out how to append it and pass it with the URL. I found a post which instructed to declare the url as a string also and concatenate it. The UserName would follow the ":" at the end of the Url.
[Code]...
We use javascript to do this from the HelpDesk site, but I need to adapt it to work from my app.
I have this little application that runs a SQL query works great, now I want to have a Start Button run the and display results then System.Threading.Thread.Sleep(300 * 1000) for 5 min then run again and display results and loop till I buttonstop_click. unsure if the sleep is the best method.
[Code]...
I am facing following problem with adodb Recordset
Error: Missing method 'instance void [WindowsApplication1] ADODB.Fields::Append(string,valuetype ADODB.DataTypeEnum,int32,valuetype ADODB.FieldAttributeEnum,object)' from class 'ADODB.InternalFields'
I am using 6.0 version of ADODB.
I'm working on a small accounting app. I have a query to show transactions with a running balance.
SELECT transactionid, transactiondatetime,
amount,
(SELECT SUM(amount)
FROM dbo.transactions as D1
WHERE D1.transactiondatetime <= D0.transactiondatetime) AS balance
FROM dbo.transactions AS D0
I capture a gamesheet for a certain week. so if I select a date on a monthcalendar the sheet applies to the weeknumber of the selected date. When I save transactions I take the date at the last day of that week as the transactiondate. I need to store a datetime though because my query works of the datetime to get an accurate running balance. How can I append now() time part to my date variable and then store that in a datetime variable to get a transactiondatetime.
Here is my code for getting a transactiondate:
Dim dt As New Date
dt = Me.MonthCalendar1.SelectionStart
'get last date of week. Friday
Dim tdate As Date = dt.AddDays(5 - CInt(dt.DayOfWeek))
I have nine pictures that I need to animate -I need to use the ToString method and a counter to concatenate a file name into a string variable from the Image.FromFile method. Once the counter reaches its maximum value, and the last picture is displayed, the counter should be reset to zero or one depending on how the first image file has been name. Also a static counter variable should be incremented in the time routine. what I have so far -- I know what I have to do; however, I just do not know how to code this properly.. Right now I have this going thru a button procedure but it needs to go through a timer.
[code]....
I've got some code to try and loop through LINQ results, but it doesn't seem to be working.
HERE'S THE CODE
Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
''# the page contenttype is plain text'
[Code]....
I can't think of a better way to do this, what i have is this function:
vb.net
Function functionDealWithHiddenFields(ByVal HTML As String, ByVal numHiddenFields As Integer)
[Code].....
which usually contains: 4 so when i loop out the names, it loops the 4 results, 4 times, instead of just showing me the names 4 times so i can then store them
why I cannot populate the data grid with the results of my loop>
Public Class FormInput
'The disabled close button declarations;written by Achmad Zeanuri
Private Const MF_BYPOSITION = &H400
[Code].....
Private Sub CopySelectedNodes(ByVal nodes As TreeNodeCollection)
For Each node As TreeNode In nodes
If node.Checked Then
'MessageBox.Show(node.FullPath)
Me.CopySelectedNodes(node.Nodes)
[Code] .....
This does not work, I want to loop through results so the textbox1 will be like 151,154,3,151, and I want to remove the last.
I have a listbox displaying sql results in a loop. Let's say I want to select one of those results and click a delete button. I have the button and box setup displaying the results just fine, I just do not have the functionality. How would I do that?
View 18 RepliesI have a data table that has thousands of entries. The table has employee production information: YearMonth, Employee ID, Pages worked and Jobtypes (e,k,o and r). I need to calculate a sum of each jobtype and a sum of pages worked for each jobtype, for each individual employee. I am pulling this data from an Access database and so unfortunately I am unable to use LINQ.[code]...
View 4 RepliesI'm having different results when running openfiles.exe manually than when I run it with Process.start() Below is the portion of code making the call. I have read in several places that using the "runas" verb might make a difference since I am running on Win 7 x64, however I am still experiencing different results.
[Code]...
Sorry for new thread--i have this code, basically a loop to ping a list of ip's return the results and save them to an access db:
[Code]...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code]...
I'm trying to find a way where i can make it loop through the results of my capture group regex query.
For instance if i have this:
VB.NET
Dim matches = Regex.Matches("<h1><span>test</span></h1>", "(?<=<h1>(<span>)?)(?<data>.+)(?=(</span>)?</h1>)")For Each item In matches.OfType(Of Match)()Console.WriteLine(item.Value)Next
And i'm trying to get the contents of <data>, how do i do it without it printing out the junk before it and after it?
quantifier isn't working, its supposed to make the <span> tag optional in the query, but it isn't.
here is some simple code:
0: dim varA = 0
thread.sleep(1000)
GoTo 0
I was wondering how do I name each new variable a different name each time through the loop (i.e. varA1, varA2, varA3)
I'm making a program when the user clicks the button it displays the number of rolls it took to get snake eyes ( 1 on each dice) I have randomized it and in the Do loop it calculates until it gets the right code. I just need some help with the code that will display in a listbox the results that didn't get picked for snake eyes.
Here is my
Public Class Form1
Dim num1 As Integer
Dim num2 As Integer
[CODE]...
Everything I know about .Net programming tells me that the behavior I see here is completely impossible. Simple code:
Structure WKSTA_USER_INFO_1
Dim wkui1_username As Integer
Dim wkui1_logon_domain As Integer
[Code]....
When I put a break point in here, I see that after RtlMoveMemory, my wk1 contains a pointer to a username, and all the others are 0. This is consistant. Now, if I change Dim test As String = "" to Dim login As String = "" and run it again, wk1 contains pointers to both username and logon_domain.
If I change it to Dim login As String, it contains a pointer to only the username. Depending on what I change that (completely unused) variable name to, I get a different result.
I have always been under the impression that it cannot possibly matter what you choose to name your variable. And that declaring a variable, and then never using it, cannot possible be different from not having a variable there at all.
I've tried this on 2 computers, with consistant results (one on .Net 3.5 and one on 4.0). When I tried converting it to C#, however, I was not able to reproduce it.
I am aware, by the way, that I can just use System.Environment to get what I need about the current user information; this was old VB6 code that was automatically upgraded (and I've edited it a little to make it more trivial).
If I'm running a Do... Until or a For... Next loop in a button click event, is there a way I can allow the user to click the same button while the loop is running and escape the loop?
View 6 RepliesIs it possible to make a For loop which count down. Like:
For i as Interger = 5 to 0
'Do stuff
Next
I am writing a program that is connected to an rs232 port and I need it to constantly be monitoring the incoming data. I think there are a few ways of doing this like checking the buffer but I need this to be running while I am connected to the port. I have a play button and a pause button for the port. When the play button is pressed, the port is open and the button is no longer enabled until the pause button is pressed. I need to have a while loop running the entire time the play button is no enabled, or pressed. I am having a hard time knowing where to implement it in the code.
View 2 RepliesI am iterating through the table rows . if the row row is null I just want to remove the row.[code]....
View 2 RepliesI'm developing a interface in VB.net which will control two stepper motors. Counting on your tips I managed to control them manually I mean, there're 4 buttons used to move the motors clockwise and anti-clockwise. The point is, the main part of our project is control the motors automatically. Our idea is based on two editable fields, X and Y, where the user would insert the displacement value he'd like the motor to move. After filling up both fields, the "GO" buttons would be pressed. So the loop would run depending on the displacement values in X and Y.
Attached you can find the main screen:
Below you can find the main code.
Public Class Form3
Dim velocidade As Double = 0.004
Dim X As Integer = 0
[Code]....
1. load gridview from an uploaded excel file (this would probably be about 300 records or so)
2. compare manufacturer, model and serial No to my MS SQL database (about 20K records) to see if there is a match.[code]is there a better way to find a match between the two?
Basically what I have are two loops, one inside the other, that will run until the given condition is met. Exactly what I want. My problem is that I want to be able to use the controls, like buttons, while a loop is going on.
I originally did not think of this until I had built this part of my program, what I want to know is if there is a way to use controls while a loop is going on or if their is an alternative.
1)I know timers can be used to meet these goals, but they did not work out as I had hoped and using two timers (1 to represent each loop) I do not believe is efficient.
2)I have considered using recursion, but have found this may not be very efficient either and am not quite sure if this will do what I want.
These loops run as long as the number the user inputted. So it could theoretically run for 100,000+ times. I am not looking for speed, but it would be good if there were a faster method that allowed me to use controls while it loops.
I need to have a specific process(method) run once a day at a given time and was wondering if this can be done using the timer control.
View 2 RepliesFound this:
Sub SurroundWithAppendTag()
DTE.ActiveDocument.Selection.Text = ".Append(""" + DTE.ActiveDocument.Selection.Text + """)"
End Sub
But I can't seem to figure out how to loop through each line of text in the selection.
Windows Forms, VB application... Forgive me in advance for this very elementary question but I am overlooking something really simple here. I would like to have a label show the current value of a variable as the for each loop runs.. I created a very simple Button Click event to figure out where its failing. As it is right now the value does not display until after the for each loop finishes running, which it should actually display the counter value each time it runs through... I know this is possible and really simple because I did it years back but for the life of me cant figure out why I am missing the bar as it should constantly update the label to reflect that?Test Sub is as follows:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim counter As Integer = 0
For x As Integer = 1 To 200000
[code]....
I've been having a bit of a problem using the while function.
Here is my code (Simplified):
Dim RandomNumber3 As Random
Dim RandomOutput3 As Integer
[CODE]..............
When running the debug, the program crashes, and when I step into the program, I find that this While statement becomes an infinite loop. This is a program that uses random number generators to assign a value to something, and this while statement is necessary so that there is never two of the same values showing (RandomOutput, RandomOutput2 & RandomOutput) Have to be different to one another.