473,513 Members | 3,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to compare value with the same textbox in C#?

1 New Member
I have a text format like this:
12-22-24-22-33-13
when user click a button then check for duplicated number in that text.
how to handle this in C#.
Jan 26 '15 #1
1 1385
Frinavale
9,735 Recognized Expert Moderator Expert
You could split the string on the "-" character.

Then loop through the array that results from the split and look for any duplicates either by using regular expressions to search for the text/number or by looping through the results a second time (skipping the index you are currently on or taking into account that you will have at least 1 match because the item you are looking for is definitely in the string) to see if there are any others that match.


-Frinny
Jan 27 '15 #2

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

Similar topics

3
13709
by: VB Programmer | last post by:
In my ASPX page how do I get the .text value of a textbox that is in the ItemTemplate of a datalist (using HTML)? The textbox contains the quantity for a shopping cart item. The textbox is called "txtQty" and the current HTML is this (I need to replace xxxx with the text value from the textbox): <A href='UpdateCart.aspx?CartId=<%#...
2
1719
by: deancarstens | last post by:
Hi, I'm a novice with VB and I've written this pretty simple script, but for the life of me, I can't get the last bit of the script to work. It should compare the value entered by the user under the BeforeUpdate event and compare it to the value in the main form. It's doing that just okay, but when I want to reset the value using the...
5
1590
by: Tradeorganizer | last post by:
Hi, I have a database with table name as test in that i have 6 colums they are name varchar (20) address varchar (20) position varchar (20) nametype1 varchar (20) nametype2 varchar (20)
6
1582
by: wilboy | last post by:
Hi I tired to compare the value in same field, eg: Staff ID TranNum 123456 1 122333 1 133222 1 123456 2? 111223 1
1
1377
by: mesut | last post by:
Hi colleagues, In fact I don't have a problem but just don't know which way is good and better. I need some advice which programming way I shall use. Since a couple of days I'm investing my knowledge in Events and Delegates to get more used to it. Here I've situation which way should you use and why?
1
1543
by: flormarinkovic | last post by:
Good morning, I have resume my old question for the follow: I have shapes in different folders, and i need to check if the field "Codi_bd" and then i have to compare the value of the fields of this shapes with the value fields that should be, according to the oficial list of values that each shape should have. I have already got the value...
1
2698
by: varunkumarid | last post by:
Hi to All, I want to Compare the Two Textbox ClientId not a Value of them, whether clientid is equal i perform something oterwise not. for (var i = 2; i <= document.getElementById('ctl00_cphMaster_grdPaymentAmount').rows.length - 1; i++) { if(document.getElementById('ctl00_chMaster_ctl04_txtPayAmount') ==...
7
2383
by: thomaaxha | last post by:
Hello , i want to compare a value of a variable with all the values in a table column c# and sql server08. if this value is in column do nothing , if it is in the column do sth .. please help me for my project!! what to use :/
0
7270
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
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...
0
7397
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. ...
0
7563
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...
1
7125
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...
0
5703
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4757
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...
0
1612
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
1
813
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.