Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB.NET] Find and match string using last 2 characters from input [NUB Question]

I have two RichTextBoxes, 1 and 2.


RichTextBox1.Text contains a CD Key, example:

SP-GSsdv-xdHXx-BSjFx


RichTextBox2.Text contains a list of CD KEYS, as follows:

SP-pazeF-wAQLv-D7f1T
SP-26KXJ-2zHF0-FXa2h
SP-HcZbE-3LriX-pvwbH
SP-pcp4L-o4NaW-7lTWk
SP-fnNGt-T5zoq-dJBqT
SP-EJJRu-5Gz2X-VRAUY
SP-ROkHN-iCELi-TZXdh
SP-Np4lf-vlrdl-k8sFx   - Target key, it is similar ending in Fx (Case Sensitive), but different from the first
SP-7Asff-8785S-SFEig
SP-CbnRy-mTZQA-sykzp


I'm trying make it so when I click a button, it takes the last 2 characters from the Key in RTBox1 ("Fx" in this case),
then it automatically finds/matches a similar CD key ending in the exact same 2 characters from RTBox2 (Case Sensitive)

Basically, it must be case sensitive and keep it's upper or lower / combined characters exactly how it's given in RTBox1.
If it was fX, fx, FX, then it should keep it's case sensitive and find a similar looking one from RTBox2.

Then Msgbox with the resulted / similar looking Key that picked from RichTextBox2 (SP-Np4lf-vlrdl-k8sFx = final result in this case)


Can anyone help me out please? I'm still new to VB.net and learning and I don't how to deal with matching strings / situations yet


Thanks in advance
Looking for PayPal to Bitcoin Daily Exchanger
-Rate 1:1 / 5% max
-My PP = EU (So EU clients only. Unless you accept 1:1, in this case I'll pay PP fee)
-Funds come from Balance only
-Funds come from legit business (no ewhore/blackhat, and I can prove it)
I have no clue about VB.NET, did some googling so I can post you some snippets at least:

This should work for getting the last two characters of your string
Code
Dim result As String = result = str.Substring(str.Length - 2)

Now you can just compare that result string to your first key's last 2 characters (use the same method to get the two last characters of that key)

You can just get the full text from your second textbox and split it into an array (or a vector or whatever you guys have in VB) with the newline character as a delimiter. After that just repeat the above steps
I still can't figure it out :\
It might be super easy but I just cannot find anything helpful on Google and so on

Can any experienced VB.NET coder please provide me a full code 0-100 for exactly what I'm looking for in OP ? It is simply too much for me at the moment :|

Will pay $5 BTC as a thank you, so I can learn from it.
Looking for PayPal to Bitcoin Daily Exchanger
-Rate 1:1 / 5% max
-My PP = EU (So EU clients only. Unless you accept 1:1, in this case I'll pay PP fee)
-Funds come from Balance only
-Funds come from legit business (no ewhore/blackhat, and I can prove it)
(Mar 4, 2020 08:12 AM)Cendrix Wrote:  I still can't figure it out :\
It might be super easy but I just cannot find anything helpful on Google and so on

Can any experienced VB.NET coder please provide me a full code 0-100 for exactly what I'm looking for in OP ? It is simply too much for me at the moment :|

Will pay $5 BTC as a thank you, so I can learn from it.

[Image: O41gPFY.gif]

Code
Dim searchFor As String = RichTextBox1.Text.Substring(RichTextBox1.Text.Length - 2)

       For Each line In RichTextBox2.Lines
           If line.Substring(line.Length - 2) = searchFor Then
               RichTextBox3.Text += line & vbNewLine
           End If
       Next

Should be good enough for you to finish the rest or whatever else
(Mar 4, 2020 08:36 AM)Ajumma Wrote:  [Image: O41gPFY.gif]

Code
Dim searchFor As String = RichTextBox1.Text.Substring(RichTextBox1.Text.Length - 2)

       For Each line In RichTextBox2.Lines
           If line.Substring(line.Length - 2) = searchFor Then
               RichTextBox3.Text += line & vbNewLine
           End If
       Next

Should be good enough for you to finish the rest or whatever else


Now it looks super easy.

Kindly PM me your BTC address or post it here if you want ✌

Thanks a bunch.
Looking for PayPal to Bitcoin Daily Exchanger
-Rate 1:1 / 5% max
-My PP = EU (So EU clients only. Unless you accept 1:1, in this case I'll pay PP fee)
-Funds come from Balance only
-Funds come from legit business (no ewhore/blackhat, and I can prove it)
(Mar 4, 2020 08:52 AM)Cendrix Wrote:  Now it looks super easy.

Kindly PM me your BTC address or post it here if you want ✌

Thanks a bunch.

3QrzesdCSnJoYNEoSxXLG7ZrigF3EKfz7d
(Mar 4, 2020 09:18 AM)Ajumma Wrote:  3QrzesdCSnJoYNEoSxXLG7ZrigF3EKfz7d

Sent 👍
Looking for PayPal to Bitcoin Daily Exchanger
-Rate 1:1 / 5% max
-My PP = EU (So EU clients only. Unless you accept 1:1, in this case I'll pay PP fee)
-Funds come from Balance only
-Funds come from legit business (no ewhore/blackhat, and I can prove it)
if you haven't solved it, I'll do it for you
(Mar 21, 2020 02:07 AM)yeio Wrote:  if you haven't solved it, I'll do it for you

I've solved it, thx anyway

Closing this
Looking for PayPal to Bitcoin Daily Exchanger
-Rate 1:1 / 5% max
-My PP = EU (So EU clients only. Unless you accept 1:1, in this case I'll pay PP fee)
-Funds come from Balance only
-Funds come from legit business (no ewhore/blackhat, and I can prove it)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by SIM-2362662Apr 23, 2020 07:06 PM 11 367 Apr 23, 2020 07:06 PM
Last Post: dracx
[C] by MordiciaNov 15, 2019 07:21 PM 3 211 Nov 15, 2019 07:21 PM
Last Post: Mordicia
[.NET] by PELockMar 13, 2019 07:11 AM 48 1,420 Mar 13, 2019 07:11 AM
Last Post: PELock