473,769 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting text from within a string

I’m using VB .Net 2003. I am reading a file into memory. Here is a sniplet of the file

[88games
gamename='88 Game
numPlayers=
alternating=
mirrored=
tilt=
usesService=
miscDetails=Thi s is a 4 player team type game where 2 players compete each tim
P1NumButtons=
P1Controls=Just Buttons+butto
P1_BUTTON1=Ru
P1_BUTTON2=Jum
P1_BUTTON3=Ru

[005
gamename=00
numPlayers=
alternating=
mirrored=
tilt=
usesService=
miscDetails
P1NumButtons=
P1Controls=4-way Joystick+joy4wa
P1_BUTTON1=Fir
P1_JOYSTICK_UP= U
P1_JOYSTICK_DOW N=Dow
P1_JOYSTICK_LEF T=Lef
P1_JOYSTICK_RIG HT=Righ

[yard

It is quite large. Anyways. Now that I have it into a variable I would like to pull out a specific section into another variable. Say the “[005]” section. I have the code returning what character the string “[005]” starts at but don’t know the command or syntax to start at a certain character number (which I have) and then read until the first blank line then put it into another variable

After that I want to do the same thing, kind of, and put the parts after the “=” sign into separate labels that I have on my form

What is my best way to accomplish this

Thank you
Joh

Nov 20 '05
11 1787
* "=?Utf-8?B?amNyb3VzZQ= =?=" <an*******@disc ussions.microso ft.com> scripsit:
Now I get an error on button click that says:

An unhandled exception of type 'System.Invalid CastException' occurred in WindowsApplicat ion2.exe
Additional information: Specified cast is not valid.


Use this code instead:

<URL:http://www.mentalis.or g/soft/class.qpx?id=6>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #11
Thank you....that did it

Much appreciated
John
Nov 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1178
by: DC Gringo | last post by:
I am a bit twisted and need some straightening out. I have a webform with 3 controls on it: a mainHeader, a sectionHeader with a label control contained in the mainHeader, and a topHeadline. In the topHeadline, I am retrieving a value with a stored procedure. I need to set that value to a label control within the sectionHeader like this: mainHeader1.sectionHeader1.sectionHeaderLabel.Text = myVariable In topHeadlines, I have:
10
2242
by: David B | last post by:
I am writing a console App with VB 2005 where I accept a text file as input, parse it and insert the text data into an SQL table. I have written the code correctly as well as I can tell because it works running it within the IDE, given that you have to go into the Debug Project Properties to specify the argument. If I build the file and go run it from the command line, specifying the argument, I get the following error: ...
1
1879
by: Jerry John | last post by:
I am working in ASP.NET with C#. I have a text file which contains datas with delimiters. For example:- MSH|^~\$|DISCHARGE|CLAY COUNTY MEMORIAL|||200502110939| I also have an XML file created with predefined tags. Some of the tags contain child element. I need to pass the data from the text file i.e the value within the delimiters should be passed to the corresponding tags within the XML file. I have done this through hard code. But i...
3
2085
by: tshad | last post by:
I have a page that I am getting a username and password as a random number (2 letters, one number and 4 more letters) I have 2 functions I call: ************************************************* Function RandomString(size as integer, lowerCase as boolean) as string Dim builder as StringBuilder = new StringBuilder() Dim random as Random = new Random() Dim i as integer dim ch as char
3
22531
by: GaryDean | last post by:
I have a button field in a gridview defined as follows: <asp:ButtonField ButtonType="Button" CommandName="AcceptOrder" Text="Accept Whole Order"> <ControlStyle Font-Size="X-Small" /> </asp:ButtonField> In the RowCommand event I have the following code: if ((string)e.CommandName.ToLower() == "acceptorder") { int myRow = int.Parse(e.CommandArgument.ToString());
12
3580
by: Angus | last post by:
I am writing a class as a wrapper around a std::map. The class is: template<class TKey, class TValue> class CGeneralMap : protected map<TKey, TValue> At the moment I have basic functions like Add, Remove etc but I am really struggling with GetValue, which will be like the value obtained from
2
6658
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double) Location: class Week5MortgageGUI Week5MortgageLogic allint = logic.allInterest(amount, term, rate); Week5MortgageGUI.java:152:cannot find symbol symbol: method allInterest(double,double,double) Location: class Week5MortgageGUI
3
1198
by: MDCdeveloper | last post by:
Hello all, and thank you in advance for any feedback/help you might post. I need help getting a web page element id out of a string variable to be used within my c# code behind page. I am trying to display a string in a literal control telling the user what was wrong with the input that they provided in the associated text box. my error string looks like this: errorMsg = "litLastName-Please enter a valid last name" I already have...
2
2054
by: hgarg | last post by:
The onpaint() is getting called before calculating the required parameters by listBox1_SelectedIndexChanged function. I tried calling it at the end of this function. But of no use. Due to this issue only half of the diagram is getting painted,some lines are missing in the diagram. private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e) { string str=listBox1.SelectedItem.ToString(); string str1=null;...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.