Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi, I am making an APA web based citation generator. All is well but I seem to be having trouble making a string have an Italic font, Here is my code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string author;
        string date;
        string TitleOfArticle;
        string Retriveddate;
        string websiteURl;
        string citation;
 
        private void Form1_Load(object sender, EventArgs e)
        {
            AuthorBox.Items.Add("unidentified");
            PublishBox.Items.Add("n.d");
 
            TitleBox.Text.Equals(Font.Italic);
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            //issues: make the richtextbox display title as italic.

            author = AuthorBox.Text;
            date = PublishBox.Text;
            TitleOfArticle = TitleBox.Text;
            Retriveddate = RetrivedBox.Text;
            websiteURl = URLBox.Text;
            citation = author + " ." + "(" + date + "). " + TitleOfArticle + ". Retrieved " + Retriveddate + ", from " + websiteURl;
            richTextBox1.Text = citation;
        }
 
        private void button3_Click(object sender, EventArgs e)
        {
            richTextBox1.Copy();
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();
        }
    }
}
As you can see in my sample code I have strings for each combobox and they record the user's input for each box. Then I combine all of them and put it into 1 string called "Citation" and when the user presses a button this string is displayed in a richtextbox. In a proper web citation for APA the title of the webpage needs to be Italic. How can I change the font style of the title and make it Italic when the user generates the citation? The string for the title of webpage is called "TitleOfArticle".
 
I appreciate everyones help.
 
Thanks.
Posted 6-Aug-12 21:14pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to change the box's font style.
http://www.java2s.com/Code/CSharp/GUI-Windows-Form/RichTextBoxFontbolditalic.htm[^] might help.
 
how to change a textbox text to bold,italic in C# windows application[^] is for a normal textbox, but might give you an idea as well.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hey Abhinav S, I found what I was looking for thanks for your help. I came across this post on "StackOverFlow" heres the link. You can find the solution from the user called "PsychoDad"
 
http://stackoverflow.com/questions/956490/search-a-sentence-in-a-string-c[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 7 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100