473,396 Members | 1,924 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.

I can't figure out how to code a string.Length and post a message that corresponds

The program is suppose to count the letters input by the user into the text box and if they are<10 a messagebox is suppose to pop up and say " username accepted" if >10 "username error"


This is what I have to work with and I don't know what to do with it. I'm using VB express
This is the example I received:
Expand|Select|Wrap|Line Numbers
  1. Dim stringLength As Integer
  2.         Dim myString As String
  3.         myString = "some text"
  4.         stringLength = myString.Length
  5.  
Here's what I tried on my form:
Expand|Select|Wrap|Line Numbers
  1. Dim txtEnteredUserName.Text.Length
  2. Dim stringLength As Integer
  3. Dim myString As String
  4. myString = "some words"
  5. stringLength = myString.Length
  6. Dim Text.Length >10 show MessageBox
  7. MessageBox.Show("username error")
  8.  
I got a few errors, I don't know what I did wrong exactly,
Feb 26 '09 #1
5 1442
debasisdas
8,127 Expert 4TB
i really do not understand your code

specially your DIM statements.
Feb 27 '09 #2
I thought the Dim statements declared my variables. On my form I have 4 things. 1 text box named txtEnteredUserName, 2 Labels one to prompt the user to enter their name and the other is named LblOutput. And 1 submit button, That is suppose to calculate the nunber of letters entered by the user into the text box. If the name entered is equal to or less than 10 letters than a message box should say "user name accepted" if the name is more than 10 a message box should say "user name error".
Feb 27 '09 #3
How do I declare my variables?
Feb 27 '09 #4
debasisdas
8,127 Expert 4TB
what are yoiu doing by the following two lines in your code ?

Expand|Select|Wrap|Line Numbers
  1. Dim txtEnteredUserName.Text.Length 
  2. ....................................................
  3. Dim Text.Length >10 show MessageBox 
  4.  
Feb 27 '09 #5
I was declaring the variables I thought.
Ok, scrap that jacked up code and check this one out.



myString = txtEnteredUserName
stringLength = myString.Length
If stringLength Then > 10 Then 'Username Accepted
If Else 'User Name Error


Errors
mystring and stringLength say not declared
Else says expression expected

How do I fix those errors?
Feb 27 '09 #6

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

Similar topics

4
by: Greg Baker | last post by:
I don't know what standard protocol is in this newsgroup. Am I allowed to post code and ask for help? I hope so.. :) Here's my problem: I am trying problem 127 of the valladolid online...
3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
10
by: Regnab | last post by:
I'm trying to test a recordset to see if the SQL query is returning a Null value. However, the IsNull() test always returns a 'False' response. I even tried: Dim NullCheck As String NullCheck =...
0
by: William Stacey [MVP] | last post by:
This code worked on fx 1.1 and now I get a "Keyset does not exist" error when trying to SignData with RSA under FX2.0. Smells like some security error, but can't debug it as I think error is...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
26
by: Bill Reid | last post by:
Bear with me, as I am not a "professional" programmer, but I was working on part of program that reads parts of four text files into a buffer which I re-allocate the size as I read each file. I...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
8
by: Microsoft News | last post by:
Greetings community at large. I have a c# app that generates a PDF file. I have a printer that prints PDF natively. But I cannot figure out how to programatically print in C# ... I can...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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.