|
-
Jul 30th, 2021, 01:59 AM
#1
Thread Starter
New Member
user enters % sign in search form. wildcard.
Code:
Dim searchText = txbBILL_NR.Text
Dim cleanSearchText = searchText.Replace("%", String.Empty)
If cleanSearchText.Length = 0 OrElse cleanSearchText.Length >= 4 Then
If searchText = cleanSearchText Then
searchText &= "%"
End If
Search()
Else
MessageBox.Show("enter at least 4 numbers")
End If
I have this method for search button in my app.
So, I already have the If condition where user enters a minimum number 4 of characters to select entries.
I need to re-make validation for percent sign. I figured out, that is kinda wildcard, but I do not understand how I can get those situations:
Could anyone please give me some advice where to look at.
1. user adds "%" sign after txbBILL_NR - the system does not add additional "%" in the background, txbBILL_NR with identical part number are found and reflected in the list.
2. the user has not added the "%" sign after the txbBILL_NR - the system adds an additional "%" in the background, txbBILL_NR with identical no. parts are found and listed. The "%" character does not need to be represented by the user;
3.user added"%" sign at the beginning or middle of txbBILL_NR - the system does not add an additional "%" in the background, txbBILL_NR with identical part number are found and reflected in the list (no changes required);
4. The "%" system only needs to be marked if the user has entered at least 4 characters in the txbBILL_NR field (assuming that the invoice number cannot be shorter than 4 characters.
If the user has entered at least 4 characters (whether they are starting characters or from the middle) and "%" is added to the beginning or middle of these symbols, the system does not add an additional "%" in the background the invoice (s) with the identical part (symbol) part are found and reflected in the list.
There are some criteria about % sign, like:
1234%
%1234
12%34
1234
and so on. I would like to understand that implementation into code, how I. can use that wildcard if user enters it, and when not. I understand that I need to use if...else conditions for this, but how correctly solve % sign stuff, no idea.
Maybe some advice from you will help me.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|