Read Hex At The Same Time Loop The Function?
Oct 29, 2011I'm a newbie in VB.. I'm editing a file that sets the click-able area of a button in a game.
[Code]....
I'm a newbie in VB.. I'm editing a file that sets the click-able area of a button in a game.
[Code]....
I should use the Timer_Tick function, to loop a data read from a COM port. The object i call uses a method that closes the thread after a fixed timeout.
obj.Read(N byte) //--> if no data come within 500ms close the thread
My question is: considering that the Timer_Tick function will be called every (for example) 100ms, How long does the total execution last? Timer_tick time + Thread Timeout (100ms + 500 ms = 600ms) or just the Timer_Tick time (100ms) causing the anticipated thread closure/crash?
I am constructing a program, i am new to Visual Basic, but i have past programming experience. I was wondering if anyone knew how to form a loop that could...lets say calculate the answer when two numbers are added together,and it would repeat this thousands of times, etc. And if there is a way, would it be possible to calculate the time taken to complete this loop.
View 5 RepliesHi. what is the difference of sleep function and pause function (using timer) between a loop.
View 12 RepliesI have created a program that saves the co-ordinates of the users mouse and saves it to a text file to be used as an auto clicker.
View 2 RepliesThe Now() function in VB.NET returns date and time which is different from the system time that I see on the right-bottom on the notification bar. It is 15 hours slower than the system time. Has anyone ever met this problem? I'm using .NET 2.0.
View 2 RepliesWhat will happen when 3 function calls same function at a time? I have 3 Function, f1,f2,f3.. Those function after completing their task will call finish() function. What will happen if Finish is Called morethan once..
View 9 RepliesHow do i use a while loop and MID$ function instead of the split function?
i'm trying to have the input (textbox) compared to a list(array) in a text document
I currently have a function that loads an XML and takes all of the nodes and makes an object with them and adds them to an array.I need to be able to now see if there are more than one xml doc in a folder, and if so also add their objects to the array until all of them have been read. How would I go about doing this? I've been searching through the System.IO. to see if I could find something but I haven't been able to yet.
[Code]...
[code]...
View 12 RepliesIs there any way to loop through the applications that run at a time (the application list from task manager) and get the application's caption?
At a moment I have two instances of "acad.exe" but they will have different application name and I have to choose one of them, but I don't want to close the other one.
If I use the process list I get only the "acad.exe" name and I cannot differentiate between them.
The code below finds a string from a text file and, if the correct month, - Monthcheck1, adds it as an item to an unsorted ListBox. I want to run through the text file again to find data for the next month. If I repeat this code for MonthCheck2, nothing is added. My question is: What is the convention for looping through the same file a second or third time?
[Code]...
A common mathematical function is the Factorial function. The factorial function takes an integer input of "n" that is greater than or equal to 1 and computes n* (n-1) * ... * 2 * 1. In mathematical texts, factorial is denoted with an exclamation point, as in n!.For this exercise,write a function called Factorial that takes a single Integer input and returns an Integer corresponding to the factorial of the inputted parameter. To help get you started, your function will look like this:
[code]...
After you have written this Factorial function, add a Page_Load event handler that calls the function, displaying on the ASP.NET web page the values of 1! through 5!.Hint: The Factorial function will need to contain a looping construct from 1 to n, where, at each iteration, a variable is multiplied by the value of the looping variable.Now I'm not asking anyone to solve this for me but rather if you could help me understand how I should go about it. I'm not really understanding how I would loop and increment this function. Would I make the variables 1! through 5! equal to the given values and have them called to the equation and then loop it and increment it as so? I'm not even sure I'm thinking this out correctly.
I am calculating the average of an array(double) using a known (smaller) array of integers, which contains the indices for the larger array to give the values for the average. Below is the function:
'
'NumLoops = Ubound(LookupList)+1 !
' i always >0
Function Mean(ByRef Y() As Double, ByRef LookupList() As Integer, ByVal NumLoops As Integer) As Double
Dim res As Double
[Code] .....
Stand alone performance (through a win32 project) form is very good for my project. e.g. a Y() = 50000 entries, LookupList=1000 entries, calculating the mean 1000 times take about 5 ms.
That beats a c++ function accessed through a rcw quite easily (takes >300ms). However, when I plumb this function into a larger project the performance drops off significantly, taking (typically) 50ms for the same test. Also if (say) I make Y bigger (say, 100 000 elements) with everything else the same I see a tiny overhead in the stand alone test (of order 1 ms), yet I see a close to linear increase in the calculation time in the larger project. The larger project is not so big (a few MB) as to make we worry about resource constraints.
I am fairly new to VB and I am struggling with not using the Reverse string.I need to take a persons name from a text box and print the name backwards in a label using lop and the MID function.I have this, but it doesn't use the MID Function, how would I change it.
Private Sub convertButton_Click(sender As System.Object, e As System.EventArgs) Handles convertButton.Click, ClearToolStripMenuItem.Click
Dim Name As String = ""
[code].....
I'm trying to loop over record set with While sqlResults.Read() But it seems that if i only have one record in the collection it will skip it and won't enter the loop, is there some kind of fix to this?
View 1 RepliesI am writing a VB.NET program and I'm trying to accomplish the following:
Read and loop through a text file line by line
Show the event of the loop on a textbox or label until a button is pressed
The loop will then stop on any number that happened to be at the loop event and when a button is pressed again the loop will continue.
Code
Imports System.IO
Public Class Form1
'Dim nFileNum As Integer = FreeFile() ' Get a free file number
Dim strFileName As String = "C:scb.txt"
[Code] .....
I'm able to read the text file but my label will only loop if I hit the start button. It goes to the next line, but I want it to continue to loop through the entire file until I hit a button telling it to stop.
My application is in VS2008 coded in Vb.net.I have a datagridview which is populated from Database.I have a save button on the same form that has DatagridView.My requirement is i want that all the records that are populated in DatagridView should be saved in a certain table of the database when the user clicks save.Im done with my save and Update code.What im not able to do is,im not able to increment the counter and move to the next row of datagridView when my For loop is executing after the click of Save button.Below is my Code.
For i As Integer = 0 To DGVStudRecord.RowCount - 1
My Code for Update and Save.
Next
[code]...
I checked the contents of the array at the end and it only held the last records within the text file, which suggest that it is overwriting the array, how can i prevent this?
So I'm kind of new to VB and am just playing around with a little project, I currently need a loop that is constantly checking the systems clock to see if it's equal to a certain time.
While Not myTime.Hour = 24
If TimeOfDay = newTime Then
nfi.ShowBalloonTip(15)
[code].....
how to get rid of the missing ingredient when it loop the second time?
[Code]...
I have been trying to find out of the last hour how to do something proberbly very simple ?
I have a button, when I click on it, I want to loop the code inside this button for 60 seconds.
How can I loop through each date in a given time period so that I can add those dates as a column name in a table. I want to create datatable with the person's name and hours he worked in a given time period. The user will select the dates and I want to show each day/date in that table as a column name.
View 1 RepliesI wrote a program which loops through a very long CSV file (50 meg) and parses the data as it goes.Sometimes, the program aborts and I get the following message:The CLR has been unable to transition from COM context 0x37a090 to COM context 0x37a200 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
I know its going to take a while. There are several hundred thousand lines of text in the file that this program is reading. I am not sure exacly waht the message means, but my program seems to work fine other than the message. odd thing is sometimes the message doesnt always pop up..
I'm using visual studios 2008, VB9 and I am trying to write an app that basically performs calculations on a set of data input by a user. During the calculations, I want to display the data at each step, and have it retained in the display area on the GUI (not overwritten by the next data being displayed).
For example:
UserInput = 1
Do
UserInput += 1
[Code]....
I tried this, and other loop structures and can't seem to get things right. The actual app is a bit more sophisticated, but the example serves well for logical purposes.
I have a random function and a for loop which sets those random numbers to an integer
For i As Integer = 1 To 4
nums(i) = Randomfunc(0, 100)
Next
[code].....
i made this code
VB.NET
Dim iString As String
If My.Settings.IPBank.Count = 30 Then
MsgBox("You alredy have the maximum amount of IP Addresses stored, delete one to add another.", MsgBoxStyle.Information, "Program Error")
[Code]...
I want it to check all of the items in the my.settings.ipbank which is a stringcollection. Before it adds and if it already exists in my.settings.ipbank then i want it not to add it. But it just adds when i run it. And then once its added it says: "Collection was modified; enumeration operation may not execute." But also before i run it. There is a warning saying: Function 'AddTo_IPBank' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. Is this something to do with it? I think i have the Next in the wrong place .
I cut my programming teeth on QBASIC so apologise if I'm a bit behind the times. I wrote a program in QB and I'm trying to convert it to VB.NET. One stumbling block I've hit is the DATA & READ facility, there does'nt appear to be an equivilant in VB. I want to read a list of data into an array using a FOR NEXT loop.
View 13 RepliesIn a loop, I need to read a list of URLs from a text file, download the web page, and search for a bit of text using a regex. I used the following code, which triggers the error "WebClient does not support concurrent I/O operations.":
[Code]...
In a loop, I need to read a list of URLs from a text file, download the web page, and search for a bit of text using a regex.
I used the following code, with DownloadStringAsync() to avoid freezing the UI, but it triggers the error "WebClient does not support concurrent I/O operations.":
Private Sub AlertStringDownloaded(ByVal sender As Object, ByVal e As DownloadStringCompletedEventArgs)
If e.Cancelled = False AndAlso e.Error Is Nothing Then
[Code].....