SelectedText wont work?

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.
9 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

SelectedText wont work?
Dummy1912
Hello,
yep me again :lol:

seems we have a custom Textbox and i and use the Inherits Control
and added a New Windows.Forms.TextBox as control
but seems i can't use the SelectedText

when i use the bottom code
i don't get any SelectedText??

i do:
Code: Select all
TextBox1.SelectedText += "some text"
'but some text don't come :(
Code: Select all
Public Overridable Property SelectedText As String
'source
http://msdn.microsoft.com/en-us/library ... -snippet-1

thanks :)
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: SelectedText wont work?
Dummy1912
no one :( thats sad
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
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: SelectedText wont work?
Usman55
Under what event are you using that code?
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: SelectedText wont work?
Dummy1912
no event #Usman55 because msdn don't speak of a event to add under it
i thought to use it like a normal function like the real textbox does

so when you do:
Code: Select all
textbox1.selectedtext = ""
i do get this part with the event we showed upstairs but we don't get any text to show :(
what are we doing wrong and how can we make it work
thanks
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
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: SelectedText wont work?
Usman55
I don't have Windows installed atm so I can't confirm anything.

Try the same code with a regular textbox and button. If it works then the problem is probably with the way you're using the code.

Good luck!
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: SelectedText wont work?
Dummy1912
still no solution? :(
so sad
o well....
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
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: SelectedText wont work?
CodenStuff
It may help if you post your code/files for us to look at and see what's going on.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: SelectedText wont work?
XTechVB
Try this (C# sorry) :D
Code: Select all
using System;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    class MyTextBox : Control
    {
        private TextBox TB = new TextBox() { Dock = DockStyle.Fill, HideSelection = false };
        public MyTextBox()
        {
            this.Controls.Add(TB);
        }

        public string SelectedText
        {
            get { return TB.SelectedText; }
            set { TB.SelectedText = value; }
        }
    }
}
You can find me on Facebook or on Skype mihai_92b
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: SelectedText wont work?
Dummy1912
thanks #XTechVB :)

you rock loove;
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
9 posts Page 1 of 1
Return to “Coding Help & Support”