Need help fast :)

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
19 posts Page 1 of 2
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Need help fast :)
Dummy1912
Hello,

can anyone help me out please
i asked a lot of people but no luck :(

i have a label like for example
hello my mail is test@test.com contact me
so i want to replace the test@test.com with a control on the same place
of this test@ instead of that text
do you understand what we are asking?
because it seems it overlap the text :(

see this image:
Image

we have tried this
Code: Select all
Dim correctString As String = Text.Replace(email, llLabel.Text)
llLabel.Ls.Add(0, llLabel.Text.Length, sLType & correctString)

but you see the image not working.
thanks +rep if you solved it :)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Re: Need help fast :)
visualtech
It it's a static string, you can make a small class to generate that text. Below is a sample class.
Code: Select all

Friend Class Helper

  Private Const _placeHolder As String = "hello my mail is {0} contact me"

  Public Shared Function getFormattedString(ByVal email As String) As String
    Return String.Format(_placeHolder, email)
  End Function  

End Class

Another approach can be take the text, and model it (will only work if the "email" is at a constant place [or index] )
Code: Select all

Dim str As String = lblHolder.Text
str.Split(New Char() {" "})(4) = "someemail@email.com"
lblHolder.Text = String.Join(" ", str.Split(New Char() {" "}))

I hope this helps, (want more: PM me)

P.S.: Sorry for the Skype incident, it crashed.
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Need help fast :)
Dummy1912
sorry but this _placeholder don't work with me.text

and not what i'm looking for :(
not even close.


we don't need a split thing
we only want to add a control on the place of the email
thats all :)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Need help fast :)
Dummy1912
i tried
Code: Select all
            mai = Regex.Matches(text, "([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})")

but same as my image :( overlaps



#visualtech
even your code seems to be an error
Code: Select all
str.Split(New Char() {" "})(4) = "someemail@email.com" 'we replace with shorter mail and get this error
System.IndexOutOfRangeException was unhandled
HResult=-2146233080
Message=Index was outside the bounds of the array.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Need help fast :)
muttley1968
why does it have to be one label why not just make a useraccountcontrol and have 3 label

Label 1 = whatever
Label 2 = the email
Label 3 = what ever

then just code a simple little text change or link label class or something
User avatar
noypikami
VIP - Donator
VIP - Donator
Posts: 151
Joined: Sat Dec 22, 2012 1:49 am

Re: Need help fast :)
noypikami
#Dummy1912 i think #muttley1968 got the right idea for that.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Need help fast :)
Dummy1912
sorry guys but i'm not agree with #muttley1968 this time
i really want to do my way :)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Re: Need help fast :)
visualtech
#noypikami, one problem would be that the string will automatically truncate itself and will look pathetic (e.g.: somethigaf...).

#Dummy1912, come on the chat. :)
Image
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Need help fast :)
muttley1968
well why dont you consider using a sorta hotspot thing so were the email is just underline it and change blue with simple code for syntaxing and then add a transparent panel to the location and size of that area of text :P
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Need help fast :)
Dummy1912
seems i need to get the location of the string
Code: Select all
.Left += ?
if i can find the locatio of the string i can replace it with my control
i tried
Code: Select all
fidx2 = 0
        For fidx1 = 0 To Text.Length - 1
            If fidx2 >= Text.Length Then Exit For
            fidx2 = Text.IndexOf("mailto:", fidx2)
            If fidx2 = -1 Then Exit For
            fidx2 += 1 'to find next
        Next
        llLabel.Left = fidx2
but not working :(
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
19 posts Page 1 of 2
Return to “Coding Help & Support”