VS 2008 : Affecting The Next Occurrence In A For Loop?
Nov 16, 2009
Dim t As String = source
For Each m As System.Text.RegularExpressions.Match In System.Text.RegularExpressions.Regex.Matches(t, ">.*?<")
search = m.Value.Substring(1).Remove(m.Value.Length - 2)
If search = "" Or haku = " " And counter < 337 Then
[code]....
What you see here, is a code that picks everything written in between > and < markers from a source code on a website. What it returns is always a time stamp in between 00:00 and 23:59 and a string. Or almost always. There is a few instances where there are two times in a row and not every other, effectively breaking the system.Also, when this happens, the first time of the two has a "-" after it, i.e 18:00- What I've been trying to do, is making the program recognize when there is an extra character (the -), delete the extra character, and then jump over the next result in the search (the following time). This would completely resolve the problem.
The thing is, no matter how much I go through it in my head, I can't seem to think of a way to affect the NEXT result without screwing up the current result or all the following results. As you can see, my code is faulty. What it does now is an emergency method (as my teacher review of the code is coming up real soon) it jumps over the time with the extra character, and lists the following time. This however is not ultimately wanted, because in the bigger scheme of things, it displays the incorrect time for the incorrect string.
Search variable holds all the results of the regex search, for easier handling, and is used for checking for the extra character.Length6 variable is boolean for determining if the result had the "-" or not. The column ariable is to list the time and the string on the same line in the textbox.Jump is the variable that makes the code skip the conditioned result from the search.The counter variable, that might seem extra, is just for extra conditioning, its use is to prevent the first 337 instances of the search.
have a list of 84000 words , and have some articles in these articles i want to replace first occurrence of each word i have in listbox e.g [code]but it used to replace the whole mytext i want to replace words in mytext and also it hang the system and very very slow and replace all occurrences.
In some of the forms ,whenever i change some properties using the Properties Window of some controls or the form they get reflected in the Properties Window but will not get changed at Run Time.
I am facing this in quite many of the forms, hence i am applying the property changes in form load, this is causing performance breach .
I am having difficulties with getting a PictureBox to resize its contents properly. I have read through my code, and cannot find any issues. I was wondering if there might be something I'm overlooking? I am using Microsoft Visual Basic 2010 Express version10.0.30319. 1. I am using an HP-Pavilion PC with a Pentium(R) Dual-Core CPU E5300 Processor. Here is the code, which I copy-pasted from my project. Underneath it is the designer code.
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub[code].....
I have a program that colors certain words, but when I do a Ctrl+Z, the textbox undoes the coloring. How do I make it stop undoing the coloring, and just the text that was edited?
Recently, I've been running some tests with C++ and VB.NET to compare execution speeds. In the last thread I posted, I talked about how I had encountered the fact that C++ was executing just as fast as VB, but got that issue resolved. Now I'm hitting my head against another wall:I had made a DLL for VB.NET to test out this theory and compare in just one program side by side execution time of identical VB.NET and C++ code. But the interesting thing? VB.NET's execution time improved such that it was now exactly identical to the execution time of C++. Spending some time with the problem, I discovered that the "Target CPU" option in advanced compile options in Visual Studio 2008 was the culprit!
Since I'm running 64-bit Windows 7, I figured making the target CPU x64 would yield the best execution time. Wrong. Here are the results in execution time of a Windows Forms application for VB.NET,calculating all the prime numbers up to 10,000,000 and getting their sum.
Any CPU: 15.231 seconds x86: 10.858 seconds x64: 15.236 seconds
Below is the code I'm using, feel free to test it yourself:Public Class Form1
I have an application half built which accesses a Access (2003)Database File. From within the application I am able to change the data in the Access File using a Data Grid. The changes to the Data File are saved and can be recalled, changed or otherwisemanipulated however, when I add too or change any of the applicationcode the Access file reverts back to it's original state losing any data or changes that has been made.
I just made a project which a registration it has Tables/Database. [MemID] [Name] [Address] etc... I try to test this program i publish this to make a installer, after the installation, i run the program i put some information:
Example: MemID : 1 Name : Julio Jose Address : PO Box
Then I save all the information. While running the program I noticed that I forgot to put a remove/delete button. I close the program, and I edit my project to put the button (remove).. after editing i try to publish, uninstall and install the program. I noticed that the information I save in the program is gone. My Question is: Is it possible to update your program with out affecting the details/information of your program?
I am here with the same Query but with a different look I want to apply the culture change to my program. I created a class library for culture change. and applied it . It is only working with the form name, i did it with two different languages and got the result. But the controls inside the form remains as it is.
i am newbie in constructing layouts in crystal report.i have details section in left side of the page
Subject A |_______|________|________ | Subject B |_______|_________________| Subject C |_______|________|________ | Subject D |_______|_________________| Subject E |_______|____Total__|________ |
there can be different number of rows at the left side,meaning it depends on output of the query.And heres the problem, i need to make another table at the right side. how to make a table at the right side or draw lines without affecting details section? this is just purely table without fields on it.
i have a string "David John Roplay" i need to replace first occourance of the space " " into double space " "i have used String.Replace() but it is relplacing all the spaces.
This should be fairly simple but i'm having one of those days, can any1 advise me as to how to replace the first and third occurance of a character within a string, i have looked at replace but that cannot work as the string could be of different lengths, all i want to do is replace the first and third occurance?
Im working on a program for my work and it is starting to get pretty in depth. Is there any way to replace just one occurence of a string. I tried this:
I have a an application that opens a SQL connection and over the course of a few hours creates and disposes of tens of thousands of DataReader objects. You could look at it as just one big loop. As the time goes by, the memory usage steadily climbs until the application/system runs out of memory and crashes.
Psuedo code would look something like SQLConnection.Connect Do Until x =1000000 Create New DataReader Use DataReader Close DataReader [Code] .....
Even though I dispose of the DataReader object when I am done with it, the memory usage keeps climbing. I found that every time I am finished with the DataReader I have to close the SQLConnection and dispose of it. When I do that it keeps the memory usage very low and the processor usage is barely noticeable. I would think I could just open the SQL connection once and close it when I am done.
Dose anybody know how I can tally instances of a particular text occurrence within a txt file using VB.net. Better explanation if I use a textbox and type in a text how I can use VB.net to search a txt file for that piece of text and return the amount counted in another textbox or label.
I wan't a method with which to find a string within another string. It should return the position of the first occurrence of the substring. (In VB 2008 !)
I need to find the first occurrence of a certain word's position in a textbox, on how to do this? Once I find out how I can get the position of the word i am searching for I can then pull the data I need from the textbox. I am using visual studio 2010 / visual basic.Since I have no clue where to start on this code, I will post what code i will be using to get rid of the data i don't need from the textbox.
Dim s As String = TextBox1.Text TextBox1.Text = (TextBox1.Text.Remove(450))i figure I can do this in a few steps to bring the searched info out of the textbox. I am open to other ideas on how to gather my data from the file or textbox. Here is what I have to do: Pull all of the players names from a replay file and put them in separate text boxes or even a listbox.
I have my program set up to download a web page with a webclient. Normally, I could just use .Substring, but there are about 25 things I need to pluck out of this page, and .Substring, or at least the way I have it set up, takes the first occurrence. The good news is, they are all URLs; they are all similar too.
Each URL is as follows: [URL]
Now, of course, this URL is just made up, but each URL starts with [URL] and ends with 'video'.
How can I hook this up so that it scans the entire page (contained in a string, read from a StreamReader connected to a WebClient), finds each URL, and then adds it to a listview?
My app is a Reader for personal use. I have it setup By Books of the Bible and by Chapters and verses.
What I would like to be able to do, is to search for Pharaoh (any word) in a textbox, click the Search Button, and every occurrence of Pharaoh (not just the word, but the entire Verse: EX: Gen Ch7:14 Blah Blah Blah Pharaoh Blah Blah. Gen Ch9 :3 Blah Pharaoh Blah); to display inside a RTF or TextBox.
I'm building an Outlook add-in in Visual Studio 2010, using VSTO with VB.net, to sync Outlook Calendar data with an internal, proprietary Calendar. Our users want to be able to open a recurring appointment in Outlook, send the Appointment details and have the internal calendar update with the recurring appointment details. I actually have code in place that works just fine for creating recurring appointments and single appointments. The problem is that I can see no difference (when viewing the AppointmentItem or RecurrenceItem members) between a single occurrence of the series being opened, or if the entire series has been opened; all the data is the same, all the functions have the same result. I can see there's the difference in menu bars, but I don't even see a way to detect that difference.
Makes the following statement about the code below:
**"The computer evaluates the loop condition in the Do...Loop statment to determine whether the loop instructions should be processed. In this case, the inputsales <> String.Empty condition compares the contenst of the input sales variable to the String.Empty value. As you know the String.Empty value represents a zero length, or empty, string if the inputsales variable is empty, the loop condition evaluates to True and the computer process the loop instructions. *If on the other hand the inputsales variable is not empty, the loop condition evaluates to false and the computer skips over the loop instructions.
Based on the code I think it is the opposite: ...that while the inputsales value is not empty it should evaluate to true and process the loop and if it is empty it should evaluate to false and skip the loop?
I want to write a simple program, which should inform me before any files getting open (like as User account control in Windows Vista or Windows 7). I came to know that all antiviruses use this technique to detect viruses before they are affecting the system. My program must ask me as "Are you allow this file to run?" and allow it if I allow otherwise terminate the file.