473,486 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Ha ha Im so lost on this that it isnt funny..and if I dont get it done..then Im done

9 New Member
Step 3 – Add code in the Form’s Load event to select the first radio button:
In the Form’s Load event, write code to select the Comma choice in the radio buttons group box.

Step 4 – Add code in the Parse Text to List button’s Click event to parse and load the list box:
You will need the variables shown in Table 1:

Variable name Type Use
delimiter String Holds the String character representing the chosen delimiter

oldIndex Integer Holds the starting position in the string for the search

newIndex Integer Holds the position where the delimiter was found in the string

length Integer Holds the length of the input string

tempString String Holds the input string from the text box

tempWord String Holds the extracted word from the string

advanceSize Integer Holds the number of characters to advance the pointer, to skip over the delimiter

Table 1
Initialize:
First, clear the list box in case there are items from a previous use.

Validate and set the delimiter:
Use an If/ElseIf/Else statement to validate that a delimiter has been selected. CR-LF means “carriage return – line feed”, which causes a new line to be started. You will use a built-in constant to represent this, called vbCRLF. Note that vbCRLF is two characters long, while the other delimiters are only 1 character long.

For the selected delimiter radio button, set the delimiter variable to the actual character and set the advanceSize for that delimiter, using the values in Table 2:

Selected delimiter Delimiter character Advance size
Comma , 1
CR-FL vbCRLF 2
Space “ “ 1
Table 2
Use the Exit Sub statement to leave the Click event if no radio button was selected.

Parse the text box contents:
Parsing a string to break out the words involves a loop and two pointer variables (oldIndex and newIndex). Both start at the beginning position, which is 0. oldIndex will always point to the current starting position for the scan (and extraction). newIndex should be set to the position of the next delimiter. Inside the loop, do these steps:
1. Scan the string from the starting position (oldIndex) until you find a delimiter. Set newIndex to the position of the delimiter.
2. Extract the word from the starting position (oldIndex) up to but not including the delimiter position (newIndex). Use tempWord to hold the extracted word.
3. Trim off spaces, and load the extracted word into the list box.
4. Move the starting position (oldIndex) forward past the extracted word and past the delimiter.

Hints:
1. Use a While loop. The condition to use will be whether oldIndex has reached the end of the input string. You can determine this by getting the length of the input string.
2. Use the IndexOf method to scan for the selected delimiter, and assign the results of the IndexOf method to newIndex. newIndex therefore points to the location of the next delimiter.
3. Use the SubString function to extract the word.
4. Remember that the delimiter size has been assigned to advanceSize.
5. Remember that there probably is no delimiter at the very end. So when the scan no longer finds a delimiter, you must check to see if oldIndex is at the end of the string. If not, you should extract the remaining characters from oldIndex forward.

Step 5 – Add code in the Build Text From List button’s Click event to load the text box:

This part is simpler! You will take the items in the list box, combine them with the delimiter, and put the final string into the text box. You will need the variables shown in Table 3:

Variable name Type Use
delimiter String Holds the String character representing the chosen delimiter
i Integer Loop counter
length Integer Holds the length of the input string
tempString String Holds the input string from the text box
advanceSize Integer Holds the number of characters to advance the pointer, to skip over the delimiter
Table 3
Initialize:
First, clear the text box of items from a previous use.

Validate and set the delimiter:
This code will be identical to the code used in the Parse Text to List button’s click event to validate the delimiter choice.

Load the text box from the list box:
You will need a loop to iterate through all of the items in the list box. For each item in the list, concatenate its value with the tempString variable. If it is not the last item in the list, concatenate the sleeted delimiter also. After all items have been concatenated into tempString, assign it to the text box.

Hints:
1. You can use a For loop here, because you know the number of items in the list (the Items.Count property provides the count of items in the list box).
2. You can test to see if the loop counter has reached the last item by comparing it with the Items.Count property to determine if you need to add a delimiter for this item.

Step 6 – Finish up:

Be sure to add the code for the Clear button and the Exit button.

Step 7: Save and run
Save all files, then start the application. Test the program using various delimiters. Be sure to enter the data in the textbox using the delimiter you have selected. Figure 2 shows a sample run using commas in the text box.


Figure 2

Then change the delimiter and use the second button to load the textbox from the list box. Figure 3 shows the screen after changing the delimiter to CR-LF, and then clicking the Build Text from List button.
Mar 25 '07 #1
1 2010
Killer42
8,435 Recognized Expert Expert
To quote the FAQ in regard to homework/coursework...

The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.

Then when you are ready post a new question in this thread.

MODERATOR
Mar 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

383
11771
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
8
3008
by: MarsFossils | last post by:
I am giving a lunch and learn talk on how to "Create your own Web Page" tomorrow and would like to mention a funny anecdote with an inspiring moral about web page design. Does anybody have any...
2
3747
by: Mark Ingram | last post by:
Hi, ive just had to make a Find dialog for an application and to get it in a similar style to the MS ones i have had to set the control style to TopMost so that i can move the caret around...
3
2594
by: William | last post by:
Hi I have an ASP.NET application that connects to an Access database. Everything works fine except for the Session object. Data in the session object is lost after I've made a call to the...
10
2672
by: Jeff | last post by:
Is there a workaround for datagrid contents being lost on postback? All other controls persist. It's just datagrids that appear to be reinitialized. It doesn't make sense to continually rebuild...
3
1631
by: nogoer | last post by:
Im having an issue with an ecommerce app i just moved to ipower.com hosting. The session is getting lost after 45 seconds. It happens like clockwork as ive timed it at least a dozen times. Ill log...
3
1173
by: Fredrik Melin | last post by:
Same problem that I had before, diffrent approach.. In my application at order-creation, the user might encounter that the item he is trying to order is locked by another user, and he have to...
3
1423
by: Alex | last post by:
Hello. Maybe someone can help me. My development computer has: WindowsXP SP2 and MSSQL Server 2000 and IIS 5.0(or 5.1) Our webserver has: Windows2003 SP1 and MSSQL Server 2005 and IIS 6.0 We are...
45
1737
by: Master Programmer | last post by:
- Constant language / system changes - Dropping of the VB language - Security configuation minefields - Loss of old code base - Time consuming to learn (then it changes every 5 minutes) - Slow...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
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,...
0
7175
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...
1
6842
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...
0
4559
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...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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 ...
1
598
muto222
php
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.