link button inside a textbox/label

darkcat02

Active member
Joined
Mar 4, 2009
Messages
38
Programming Experience
1-3
hi everyone,

is its possible to have a link/button inside a textbox or label... or other term for that...

for example.. i am populating some chapters in a book... then i would only display 250 chars from each chapter... then i would end it and add a "Read More" text in each chapter.. and when they click it.. i would populate the whole chapter of selected chapter in the textbox...

any ideas? thanks
 
yes ive heard about richtextbox... but honestly i dont understand how to use it... currently im using a textbox which i commonly use where i populate the data... if i were to use a richtextbox... i will replace my textbox?

can u give me a simple code on how to use the richtextbox...?
 
Yes you would replace your current TextBox. How about you go and do a bit of research for yourself first? There's plenty of information available regarding the RichTextBox on MSDN and the web in general. If you can't find what you need or you don't understand what you find, THEN post back and ask for help but try first.
 
sorry about that... ^_^ i found myself looking at the the toolbox.. and i found it... in these past few days.. ive research about it.. and all i can see is a code where a textbox is converted into a richtextbox... which i want to rip my hair off my head about the code... well.. i will try to experiment on this stuff.. until i get my answer on my question.. thanks by the way
 
I'm not quite sure where you've been looking if that's all you've found because there's lot's of information around.

RichTextBox on MSDN
[ame=http://www.google.com.au/search?q=richtextbox+.net&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:eek:fficial&client=firefox-a]RichTextBox on Google[/ame]

I don't even know what "a textbox is converted into a richtextbox" means because that's like turning a cat into a dog. They are two different things so you can't convert one into the other.
 
anyway sir... in every line in my richtextbox i need to add a linklabel "Read More"... is there any possibility i can do this?

VB.NET:
cnnBL.Open()

            ''POPULATE RESULT PANEL ALL CHAPTERS & VERSES
            Dim BLReader2 As OleDb.OleDbDataReader
            Dim cmdBookInfo As String = "SELECT BookNum, Chapter, Verse, Narration FROM BibleVerses " & _
            "Where BookNum = " & BookNumTag & " ORDER BY Chapter, Verse"
            Dim BLCommand2 As New OleDb.OleDbCommand(cmdBookInfo, cnnBL)
            BLReader2 = BLCommand2.ExecuteReader()

            If BLReader2.HasRows Then
                Do While BLReader2.Read()
                    Dim chapter, verse, narration, nr As String
                    chapter = BLReader2("Chapter")
                    verse = BLReader2("Verse")
                    narration = BLReader2("Narration")
                    nr = "CHAPTER"

                    Dim link As New LinkLabel
                    link.Text = "Read More"
                    link.Tag = chapter

                    If chapter = 0 Then
                        If verse = 0 Then
                            LabelNarration.Text = ""
                        End If
                    Else
                        If verse = 0 And narration.ToLower.Contains(nr.ToLower) Then
                            LabelNarration.Text &= ""
                        ElseIf verse = 1 Then
                            LabelNarration.Text &= nr & " " & chapter & vbCrLf & vbCrLf
                            'LabelNarration.Text &= verse & " "
                            LabelNarration.Text &= Mid(narration, 1, 250) & "..." & vbCrLf & vbCrLf
                            LabelNarration.Controls.Add(link)
                        End If
                    End If
                Loop
            End If

BLCommand2.Dispose()
            cnnBL.Close()

but when i do that.. the control is on the top of the rich text box.. not with the text.. any ideas?
 
You don't use LinkLabels. As I said, the RichTextBox control supports hyperlinks itself.

[ame=http://www.google.com.au/search?q=richtextbox+.net+hyperlink&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:eek:fficial&client=firefox-a]richtextbox .net hyperlink - Google Search[/ame]
 
hyperlink or linklabels.. i cant find any answer... let me get explain a little more further...

Chapter 1

text here...
Read More

Chapter 2

text here...
Read More

as you can see... this is the output on my richtextbox... the gray-colored fonts are from database and the blue-colored fonts are the links...

any ideas how to do this...??? my code are given above... on how to populate the data... my problem is how will i insert those links in each line...

edit: and my richtextbox is a multiline.... it is on the same richtextbox...
 
Back
Top