Results 1 to 5 of 5

Thread: [RESOLVED] fonts with textbox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2005
    Posts
    30

    Resolved [RESOLVED] fonts with textbox

    i have 2 text box and 1 button
    Button1, TextBox1 and TextBox2

    i am applying font and color to TextBox2
    now when i click on Button 1, i need to send text of TextBox2 to TextBox1.
    code for that is simple
    on click of button1
    TextBox1.text=TextBox2.text


    Problem i am facing here is font and color which i changed in textbox2 is not transfered to textbox1. Why? What should i do? please help

    Thanks

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,443

    Re: fonts with textbox

    The Text property contains only the characters. The Font property contains the font and the ForeColor and BackColor properties contain the text and background colours. If you want your Button to transfer all the font and colour information then you need to copy those properties as well.

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,817

    Re: fonts with textbox

    Quote Originally Posted by aditya12c
    i have 2 text box and 1 button
    Button1, TextBox1 and TextBox2

    i am applying font and color to TextBox2
    now when i click on Button 1, i need to send text of TextBox2 to TextBox1.
    code for that is simple
    on click of button1
    TextBox1.text=TextBox2.text


    Problem i am facing here is font and color which i changed in textbox2 is not transfered to textbox1. Why? What should i do? please help

    Thanks
    Hi,

    Even for Fonts and Color is it the same way.
    Here's an example:

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         ' Set only for TextBox1 a BackColor and FontTyle you'll see that TextBox2 takes it over
    3.         TextBox2.Font = TextBox1.Font
    4.         TextBox2.Text = TextBox1.Text
    5.         TextBox2.BackColor = TextBox1.BackColor
    6.     End Sub

    Hope it helps,

    sparrow1
    Last edited by sparrow1; Apr 14th, 2006 at 02:34 AM.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2005
    Posts
    30

    Re: fonts with textbox

    Thanh Dude it worked

  5. #5
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,817

    Re: fonts with textbox

    Quote Originally Posted by aditya12c
    Thanh Dude it worked
    No problem, mark your thread as resolved.

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width