Results 1 to 13 of 13

Thread: [RESOLVED] [02/03] font dialog

  1. #1

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Resolved [RESOLVED] [02/03] font dialog

    hi guys..
    i would like to thank u guys for the great help extended to me from this forum and i have learned a lot from u guys...i need ur help again...
    i am thinking of creating a config file where in i show the dialog box for the font to b selected creating the dialog is ok but i would like to know how do i go further ....like i want to store the font in a table and then set that font in the entier package....

    i have created the dialog box as below
    Code:
     Dim fd As New FontDialog
            fd.ShowDialog()
    
     Dim SelectedFont As Font
           SelectedFont = fd.Font
    the querries r
    how do i get the selected font from the dialog box.. the selectedfont cannot b taken in the text file or if the same is to b stored then pls. let me know how...

    2ndly when i get the font...how do i set it to the textbox...

    i tried
    Code:
    TextBox1.Font = txtFont.Text
    but it gives error....txtfont.text is in blue line...so it wont accept...
    pls. help...thankx a lot

  2. #2
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [02/03] font dialog

    You have to store each font as 3 parts: Name, Size, Style

    P.S. If someone knows a better way of doing this, I'm all ears.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  3. #3

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Re: [02/03] font dialog

    Quote Originally Posted by Jenner
    You have to store each font as 3 parts: Name, Size, Style

    P.S. If someone knows a better way of doing this, I'm all ears.
    thankx for ur quick response jenner...but can u pls. guide me to a example where i can know how to do that ? get the name, size and stype of the font....
    thankx a lot for being such a great help...thankx

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [02/03] font dialog

    Since this is [02/03] and you don't have the option of using My.Settings, I'd do as Jenner suggested.
    The Font class has Name, Size and Style properties and those are the values you need to store. You can later reconstruct the font by instantiate a new font object and pass those values to the constructor or just set its properties.

  5. #5

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Re: [02/03] font dialog

    great...i got it....i created 3 text boxes to store the name, size and style but how do i set the font property of a text box...
    pls. help...thankx

  6. #6
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [02/03] font dialog

    Code:
    Textbox1.Font = New Font(....)
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  7. #7

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Re: [02/03] font dialog

    Quote Originally Posted by JuggaloBrotha
    Code:
    Textbox1.Font = New Font(....)
    thankx for ur quick response....i tried ur code...
    Code:
    TextBox3.Font = New Font(txtFont.Text)
    but it gives a blue line and states
    Code:
    overload resolution failed coz no accessible 'New' accepts this no. of argument.
    pls. guide....thankx

  8. #8
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [02/03] font dialog

    New Font("Fontname", 18, FontStyle.Regular)

    Fontname is the name of the font family.
    18 is the point size
    FontStyle.Regular is the style.

    Look at the intellicode that pops up, it's all right there in front of you!
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  9. #9
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [02/03] font dialog

    Quote Originally Posted by kuldevbhasin
    thankx for ur quick response....i tried ur code...
    Code:
    TextBox3.Font = New Font(txtFont.Text)
    but it gives a blue line and states
    Code:
    overload resolution failed coz no accessible 'New' accepts this no. of argument.
    pls. guide....thankx
    I'm sorry, I posted the code assuming you actually paid attention to what you're doing.

    Quote Originally Posted by Jenner
    Look at the intellicode that pops up, it's all right there in front of you!
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  10. #10

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Re: [02/03] font dialog

    thankx a lot guys.....i got it right....i have done it in the following manner....
    Code:
        Private Sub btnSelectFont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectFont.Click
    
            Dim fd As New FontDialog
            fd.ShowDialog()
       
            Dim SelectedFont As Font
            SelectedFont = fd.Font
            Dim mFontName As String
            Dim mFontSize As Integer
            Dim mFontStyle As FontStyle
    
            txtFont.Text = SelectedFont.Name
            TextBox1.Text = SelectedFont.Size
            TextBox2.Text = SelectedFont.Style
    
            mFontName = txtFont.Text
            mFontSize = Val(TextBox1.Text)
            Select Case Val(TextBox2.Text)
                Case 0
                    mFontStyle = FontStyle.Bold
                Case 1
                    mFontStyle = FontStyle.Italic
                Case 2
                    mFontStyle = FontStyle.Regular
            End Select
            TextBox3.Font = New Font(mFontName, mFontSize, mFontStyle)
        
        End Sub
    thankx a lot for all ur help ...now if i am not asking for more...i would also like to know that can we change the font of the report (crystal report) from the program itself....i mean all the report cols.
    thankx a lot.....

  11. #11

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Re: [02/03] font dialog

    can someone pls. guide me for changing the font of the report through the prog.itself pls....
    thankx a lot...

  12. #12
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [02/03] font dialog

    I would make a new post about that in the Crystal Reports forums if I were you. That's a very different topic.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  13. #13

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Re: [02/03] font dialog

    Quote Originally Posted by Jenner
    I would make a new post about that in the Crystal Reports forums if I were you. That's a very different topic.
    done as u instructed....and would mark this as resolved as u guys have helped me and have solved this particcular prob.

    thankx a ton to all u guys.....

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