473,396 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

length of variable

Hi
I am writing a short app that will collect some information and produce a
text file based on that information.

One of the values that goes into this text box must be max of 8 characters
long - otherwise it should be truncated to 8.

I used a statement based on if the length is > 8 then substring it to 8 but
i couldnt get the code to work.

Could someone please give me an example? The input is in a text box called
tbName.

thanks

Doug
Feb 23 '06 #1
2 1670
Why not post your code that does this and let us tell you what's wrong with
it?

Pete

"gordon" <go**********@optusnet.com.au> wrote in message
news:43**********************@news.optusnet.com.au ...
Hi
I am writing a short app that will collect some information and produce a
text file based on that information.

One of the values that goes into this text box must be max of 8 characters
long - otherwise it should be truncated to 8.

I used a statement based on if the length is > 8 then substring it to 8
but i couldnt get the code to work.

Could someone please give me an example? The input is in a text box
called tbName.

thanks

Doug

Feb 23 '06 #2
> Hi
I am writing a short app that will collect some information and produce a
text file based on that information.

One of the values that goes into this text box must be max of 8 characters
long - otherwise it should be truncated to 8.

I used a statement based on if the length is > 8 then substring it to 8 but i
couldnt get the code to work.

Could someone please give me an example? The input is in a text box called
tbName.

thanks

Doug


Are you by any chance trying

tbName.Text.Substring(0, 8);

then try this:

tbName.Text = tbName.Text.Substring(0, 8);
(explanation: strings are immutable, the various methods on string
don't modify the existing string but return a new, modified one)

Hans Kesting
Feb 23 '06 #3

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

Similar topics

5
by: MLH | last post by:
I'm working with lots of long strings now, it seems. I have to import them & parse them constantly. The A97 memo field type supports only 32768 chars. What happens when this is processed... Dim...
5
by: dam_fool_2003 | last post by:
Hai, I studied that the array size is fixed. But I come across a word called "variable length array". Is it possible to change the array size? So I tried the following: #include<stdio.h>...
18
by: Panchal V | last post by:
I want to access a variable length record in C, the format is as follows : +---+---+-----------+ | A | L | D A T A | +---+---+-----------+ A - Some Data (1 BYTE) L - Length the Data that...
14
by: Luiz Antonio Gomes Pican?o | last post by:
How i can store a variable length data in file ? I want to do it using pure C, without existing databases. I'm thinking to use pages to store data. Anyone has idea for the file format ? I...
1
by: Guadala Harry | last post by:
Just wondering if there is a quick way to get the length of a string variable while debugging. I don't want to have to modify the code and restart the application in order to get the length of a...
16
by: John | last post by:
Does the length of my C variable names have any affect, performance-wise, on my final executable program? I mean, once compiled, etc., is there any difference between these two: number = 3; n =...
2
by: Frank Swarbrick | last post by:
I'm just learning about embedded SQL, so be gentle... My basic question is, if I use a fixed length host variable for a column defined as VARCHAR, will trailing spaces be removed (or not) upon...
6
by: foreverbored75 | last post by:
Hello All! I am just learning c++ in school and I have the following question: Is there a way for the user to input the length of an array (console application) without using another variable?...
13
by: lak | last post by:
I want to know what is the variable length in c. I K&R they stated that atleast 31 character. But I give 1 lakhs length to a variable, but my compiler doesn't say any error. It accepts it.Then...
7
by: Cromulent | last post by:
In section 6.7.5.2 it states the following: If the size is not present, the array type is an incomplete type. If the size is*instead of being an expression, the array type is a variable length...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.