I have a large string in which I need to replace specific strings with other values. For example, within this string I might see the following characters: [[sub id=5]]. I am trying to replace those substrings with values, pulled from a table and based on the id. What would be the simplest way to accomplish this. My first thought was to loop through and examine each character and note their positions when they match the pattern. I would then have to identify the id. That would be fairly complicated, however, and there must be a better way.
Trying to write an app to load a Text file and then search for substrings that contains some specific characters to compose a list. Tried first loading the text file into a StreamReader then search line by line for my substrings. Had to write a lot of code to identify my strings, but it worked ok. Then tried loading the text file into a RichTextBox then use RichTextBox.Find(......) to look for my substrings. The " .Find" property makes the code really simple, but using RichTextBox the app was really slow.
Using Stream the loop was completed in about 2 minutes and using RichTextBox in about 30 minutes! I will need to make a lot of searches and using RichTextBox is lots easier, but is too slow. Is there any way to perform search operations using Streams instead making a loop and go looking line by line??? Or what else would be a good solution to search for strings in a text file??
First, the overall objective is to find the best point within a multipoint filled 'star', at which to start drawing text. That is, depending upon the size of the star and the number of points, there is a larger or smaller area within the points that is filled with colour. So a 5 point star has a relatively small area that is filled, in which to draw text. A 40 point star of the same radius has a much larger area filled. If I can determine the size of this area as a rectangle, then I can measure the string and draw within it using the best fit font and starting position. The code below is an attempt to answer the question but I am stuck trying to find the text area rectangle within the filled portion of the star. Some of the code exists purely to explore the means to determine how to identify this rectangle (and is probably the totally wrong direction).
The second part of the problem is in exploring the options, I tried to draw a vector to different points on the circumference of the star. This is the code highlighted. The lines drawn do not seem to be the correct length nor the correct angle but I cannot see why.[code]...
Ok. So I have a form, a textbox, and a RichTextBox. In the RTB, there is justsomemiscellaneoustext. In the textbox, it says "Save "Test"". When I press Button1, I want my program to parse the text in the textbox, find "Save", and realize that means to save the text in the RTB to a txt file with the name "Test" (the text next to 'save' in quotes).
Using Excel Automation classes I am seeking to save an Excel file as a delimited text file. The examples given in the MSDN library refer to versions older than Express 2008 with (apparently) different syntax options for FileFormat.Based on the snippet shown, I get a COM exception error (800A03EC). Other variations produce the same error.
Am I improperly applying the Automation features? Imports System.IO Imports Microsoft.Office.Interop
I'm using Visual Studio 2010 and automating Outlook 2007. I am writing a program that executes on incoming mail (which I have that working), but I want this program to inspect the subject line for a 5 character string that will be in the format of AB123 (can be any 2 letters followed by any 3 numbers). What is the best method to accomplish that?
so say I have a string called Cmd, and the text inside the string is Restarting server in ()..., what I was wondering was how I would go about inserting different substrings like 3, 2 and 1 in between the two parentheses? I know about Cmd.Insert() but I don't know how I would make it go between the two parentheses.
Alright I am taking an XML file which has a bunch of tags and I'm trying to eliminate everything but whats inbetween certian tags for instance the input maybe
unless they say they are safe. Average consumer can protect themselves>not knowledgeable enough to always protect selves</w:t> I want to go through and remove those end tags but when i used the remove string it didn't let me specify a string to remove it the two arguments were where to start and how long. how do i specify what to remove?
I have made a code where I write a recipe to a file and then I can read from the file and it is output in a listbox. I need to allow the user to change the amount of people served and then the quantities change to suit the serving number. The serving number is input and the rest of the code works apart from the changing the quantities bit.
The code that I am using is below. I have no idea if i'm doing it right though.
I need to find all strings in given text file which would look like:
Hi thisisme Bye Bye Hi thisisyou Bye Bye Hi someone Bye Bye
so, i need the result to be:
thisisme thisisyou someone
also, there is all sorts of other text before this and after this (in source text file)now, i have this, which doesnt work quite well:
Public Function midReturn(ByVal first As String, ByVal last As String, ByVal total As String) As String If last.Length < 1 Then midReturn = total.Substring(total.IndexOf(first))
I am a little bit confused by the following VB statement commands = Regex.Split(script, _ "GO", _ RegexOptions.IgnoreCase)
I know what regex.split does. I know what the first parameter is. The second parameter is what I'm confused by. I think it is using the word "go" as a delimiter to split the first parameter into an array of substrings. But I don't understand what that refers to.
how can i track how many times a specific word appears in a text box then display the number of times found in a message box?
for example if i type this in a textbox: today is really hot, it is not very convinient to be outside, it is better if we go swimming
and i am looking for the word "is" troughout the sentence, it appears 3 times yet I am not sure how to make a code so it does count the times "is" is being found and then display it with a message:
I am trying to write a program that separates a string into 2 substrings.Lets say I need the entire string to be 15 letters long.I need to break the string up so that the program reads it as two words.Lets say that the first word has to be 8 letters long and the second word has to be 6 letters long.So if I type it like this: Computer Screen
That should be 15 letters including the space between the two words.I need the program to read the string to make sure that the entire string is 15 letters long and if its 15 letter long continue, but if it is not 15 letters long stop and give me an error.If is 15 letter long next the program needs to read and make sure that the first word is 8 letters long and if it is print out the first word and continue but if not it needs to give me error.
Lastly if the first word is 8 letters long it needs to read and make sure that the second word is 6 letters long and if it is print out the second word and then continue, but if it is not give me error.The problem I'm having how to declare the first and second word and substrings, can someone please help me understand how substrings works and declare them after I have declared a string.
I found this function that replaces multiple substrings within a string on the internet but it gives an error on one of the parameters.It doesn't like this one:
ByVal ParamArray FindChars()) As String
Can you look at the code and correct the error since I don't yet know about explicitly typed parameters?
Emad Public Function ReplaceMultiple(ByVal OrigString As String, _ ByVal ReplaceString As String, ByVal ParamArray FindChars()) _[code]......
I'm having a problem when trying to identify if the CD on the drive is virgen (CD-R or CD-RW).I'm using the following code:
Public Function ExistsCDOnDrive(Drive As String) As Boolean Dim FSO As New Scripting.FileSystemObject If FSO.Drives(Drive).IsReady Then ExistsCDOnDrive = True End IfEnd Function
How to convert every key to something that i can identify.E.g. This returns the actual character "a" or "b" or "6". Not in the format i need it to be.[code]....
How to my Application identify . About Windows Restart Timing And How much time Windows Restartand Thats alllogging it in Txt filei mean My application Logging Text oftime and date when Its Process Killed Like Closed
that is VB.6 code something Acording to my thread Private Sub btnWaitForExit_Click( _ ByVal sender As System.Object, _
I've got a simple Windows Form Application that will tell you the drives on your computer, in a multi-line format using a Rich TextBox.So, If there were the C:\ and d:\ drives on my comp then It'd look like this
C:\ D:\
So, if there is an external drive (such as a USB under the "F:\" directory named "My Data" what would be the way to find the name of that drive, assuming that I do not already know the name Here's my code.
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click RichTextBox1.Text = "" If IO.System.Directory.Exists("F:\") then RichTextBox1.Text = (TextBox1.Text + "F:\" + Environment.NewLine)
How can I uniquely identify a PC using vb.net code? Finding the PC name wil not work, as some users might use the same name. Please explain step by step, as vb.net is new to me.
I am writing a search engine whose purpose it is to search all kind of blogs for specific kinds of content.I'm particularly focusing on these blogs engines:
Blogger LiveJournal MySpace Open Diary
[code]....
Is there any way I can use google to find links that are from a specific type of engine, like for example wordpress?
We are trying to identify the best archtecture while using a ORM like LINQ to SQL. The archture we are defining is for sort of framework that other applications will access either trough directly referencing the DLL or through a webservice. We have .NET apps and PHP apps.The possibilities are: Multiple data contexts: Separting the database into units of work and create separate contexts for each one.
Pros:
Easy of use Classes will be broken into different namespaces Smaller domain to maintain
Cons:
Objects have to be duplicated if related, creating maintenance hell Objects cannot be passed between context, creating the need for another hit on the data base Single data context: All tables, views, procedures, reside in the same huge context.
I have 2 buttons that will open the same form. but depends on which button is calling, the operation will be different. How can I identify that this form is called from button 1 or 2.Also, if we want to have a password in the vb.net stand alone application, should we use shared property?
I'm retrieveing the current path with: Dim paths As String = HttpContext.Current.Request.FilePath Which returns something like /VHP/hmo.aspx. What I need to narrow down is the FOLDER (VHP). How do I remove the / before it and the /filename after it?
I need to identify an ID number and a password. Like this,(Form1) there's a two textboxes, one is the ID number and the second one is the Password, when I enter the two it means i Log-in, the system needs to identify if the ID number and the password is registered in mySQL, then if it is registered a message box will appear "You are log-on" and a form will show (form2) in 10 to 15 seconds that is having the information of the student, then it will automatically close then it will go back to the form1 which the another user will log-in again.
(this is Form1 too) then here is my second problem, like what i said in the first problem, the program needs to identify that the student is already log-on the school and he is going to log-out, (like this, system is going to identify that the id number and the password is already declared on the first form, so it will be the log-out code, then a message box will appear "You are Log-out".
(Form3) then here is my third problem, i need to identify how many people is inside the campus and not going out on the campus. The person or student that is not logging-out on the program or the system will be count when i click the Button 'Count' and the number of student inside the campus will be display in a 'Label'(it will be inserted also or having record on mySQL tableInside).
('Form4') then my fourth problem is the system needs to identify how many students did log-in on the campus. Or the system will identify how many person input their ID Number and Password on the first form ('Form1', it will be inserted or having record on mySQL tableLog).
Does anyone know how I could get my app to show the ISP of the machine it is running on, I can get internal and external IP addresses, just need to know if possible and how to look up ISP from this information[url]...
I am working with the Richtextbox for the first time. Currently I can Bold the text from the textbox (shown below) but I want to alter this so that I can do the same thing regardless of what Richtextbox I am in. How do I do this without naming the Richtextbox specifically?
VB ' Sample Private Sub tslBold_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles tslBold.Click StyleItalic(rtxtGoals) [Code] .....