473,473 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

working with textbox in visualbasic 6.0

3 New Member
I have two textboxes, where i give input in one textbox and it reflects in another textbox. for eg., entering page numbers in the first textbox will be displayed as 1,2,3,4.... in the second textbox.Now if i want to delete a particular number how can i delete. Solution please
Jul 18 '06 #1
6 2579
BSOB
77 New Member
tough... you gave the example 1,2,3,4... it is fairly easy if you know that the string will be EXACTLY that format. im going to assume that, just so i can give a fairly easy solution.

i assume you ALREADY have something like this:
text1_change()
text2.text=text1.text
end sub

if we know that the "page numbers" are always going to be one digit numbers (like your example) then we can do this:
text1_change()
dim i as integer
const BadChr = "4" ' the page number you DONT want.
for i = 1 to len(text1.text) 'looks at each character individually
if mid(text1.text,i,1) <> badchr then text2.text = text2.text & mid(text1.text,i,1)
next i
end sub

input: "1,2,3,4,5,6,7"
output: "1,2,3,,5,6,7"

if you want to remove that extra comma, or have more than 1 digit numbers, or if the input could be a different format, i wish you would explain that in your question. but until people learn to explain there questions, i will answer them as they are written.
-bsob
Jul 18 '06 #2
dayalanstephen
3 New Member
Thanks for your reply BSOB,
the input will be either 1 digit or 2 or 3 or more digit, which will in turn reflect in the second textbox, If i want to delete a particular number along with the comma by getting an input through a inputbox how should i write the program. Solution please.
Jul 19 '06 #3
steve young
6 New Member
Hi I'm afraid I don't know your solution, but I wonder, could I be cheeky? I am trying to write a program that has 17 text boxes on it, each being hidden until the appropriate button is pressed. I would like to be able to have input from the box I am using (i.e. January, Febuary, etc, put into another (hidden) text box automatically, similar, I think, to what you are doing. Is it possible to share some code? I am a complete beginner though.
Jul 19 '06 #4
BSOB
77 New Member
steve, start your own thread AND please be more specific.

dayalanstephen,
thank you for being more specific.

dim Unwanted as string 'in general declarations for big scope
private sub ChangeUnwantedBtn_click() 'a button to change the unwanted number
Unwanted = inputbox("what number dont you want?")
end sub
private sub text1_change()
Dim CurrentNum as string 'the current number itis reading
Dim CurrentPosition as integer 'the position in the string that it is reading
do until currentposition = len(text1.text)+1
currentposition = currentposition + 1
if mid(text1.text,currentposition,1) = "," then
if val(currentnum) <> val(unwanted) then text2.text=text2.text & val(currentnum) & ", "
currentnum = ""
else
currentnum = currentnum & mid(text1.text,currentposition,1)
end if
loop
if val(currentnum) <> val(unwanted) then text2.text=text2.text & val(currentnum)
end sub


i think that will do it for you. could be typos and code has not been tested. on the "do" line, im not sure if you want the "+1" on the end or not, you will have to test that.
-bsob
Jul 19 '06 #5
dayalanstephen
3 New Member
thanks for the reply bsob,
i tried with the codings which you gave, but it does not reflect the textbox2.
Also i want to know why you use text1.text coz i use an inputbox and that should directly reflect textbox2 where you have the numbers like 2,4,8,12,35,99,105 in textbox2. Through an inputbox i select the number that is unwanted as the same code which you have used
private sub ChangeUnwantedBtn_click() 'a button to change the unwanted number
Unwanted = inputbox("what number dont you want?")
end sub
but please tell me why you use text1_change( ) and please help me out line by line with comments what that particular line does. Please BSOB......
Jul 20 '06 #6
BSOB
77 New Member
I assumed that your application would have one number you didnt want, and you would be putting in lots of data (into text1) without changing your unwanted number. That would allow you to type into text1 the text that you have and any time that you type, it will post that text (from text1 to text2) without the undesired number.

text1_change() will update text2 as often as you type anything into text1. that is why i used it.

from reading your question, i gather that your raw data is input into text1 and then you want the editted data (without undesired number) to appear in text2. is that correct?
ill do line by line help when i feel like i fully understand your question. use examples, use "what ifs" and try to give me as clear an idea as possible, thanks.
-sorry for being away for a few days.
Jul 25 '06 #7

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

Similar topics

2
by: Nick | last post by:
In VS 2003 and VS 2005 beta 2 I am trying to write a simple program. It has a datagrid and a textbox along with a menubar. There is a command in the menu bar which is "Run Query" and has the...
0
by: Paul | last post by:
Snippet from web.config: <startup> <supportedRuntime version="v1.0.3705" /> <requiredRuntime version="v1.0.3705" safemode="true"/> </startup> <runtime> <assemblyBinding...
1
by: Mariame | last post by:
Hi Everyone I have a textbox that i created online in Form Load: "Dim TB1 as new TextBox" I want to validate that this textbox contains numbers only??? Is There is a way i can do it uing...
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
6
by: Steve | last post by:
I am new to vb.net. I have a textbox. I want the user to be able to only enter numbers between 2 and 12 into the textbox. Is there a way to do this? Thanks for any help.
1
by: harinathch | last post by:
Hi, Iam working with myapplication.exe.config file in my vb.net windows application.Its working fine in my development environment. When i test this application in some other machine using exe and...
7
by: =?Utf-8?B?SmVycnk=?= | last post by:
Using VB express, I have a textbox in a form and want to ask the user to input a number , If the number is 114, then I want to do a form2.show /me.hide so the form2 comes up, but if they put in the...
17
by: AWW | last post by:
Using Textbox.Text = "123" & CStr(13) & "456" I expect 2 lines on the screen but get 1 line with 13 in it. It worked once in a RichTextBox but then stopped. I just want to display aligned tabular...
0
jas16183
by: jas16183 | last post by:
Hi Guys, need some help here, Im working on a project in vb.net, the problem im facing is that my tableadapter.update(dataset.datatable) is not functioning, the datatable has a relation with...
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
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
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...
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,...
0
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
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
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.