Click here to Skip to main content
15,894,646 members
Home / Discussions / C#
   

C#

 
QuestionHow do i learn c# programming fast Pin
awedreh3-Jun-09 7:01
awedreh3-Jun-09 7:01 
AnswerRe: How do i learn c# programming fast Pin
Luc Pattyn3-Jun-09 7:05
sitebuilderLuc Pattyn3-Jun-09 7:05 
GeneralRe: How do i learn c# programming fast Pin
EliottA3-Jun-09 7:15
EliottA3-Jun-09 7:15 
AnswerRe: How do i learn c# programming fast PinPopular
Nagy Vilmos3-Jun-09 9:49
professionalNagy Vilmos3-Jun-09 9:49 
GeneralRe: How do i learn c# programming fast Pin
Luc Pattyn3-Jun-09 10:01
sitebuilderLuc Pattyn3-Jun-09 10:01 
GeneralRe: How do i learn c# programming fast Pin
Luc Pattyn3-Jun-09 10:08
sitebuilderLuc Pattyn3-Jun-09 10:08 
GeneralRe: How do i learn c# programming fast Pin
Nagy Vilmos3-Jun-09 21:34
professionalNagy Vilmos3-Jun-09 21:34 
AnswerRe: How do i learn c# programming fast Pin
Christian Graus3-Jun-09 10:31
protectorChristian Graus3-Jun-09 10:31 
AnswerRe: How do i learn c# programming fast Pin
Guffa3-Jun-09 18:58
Guffa3-Jun-09 18:58 
QuestionNeed help with this Excel sheet issue - sheet listed that is not in the Excel file. [modified] Pin
DeepToot3-Jun-09 6:31
DeepToot3-Jun-09 6:31 
AnswerRe: Need help with this Excel sheet issue - sheet listed that is not in the Excel file. Pin
Mycroft Holmes3-Jun-09 14:27
professionalMycroft Holmes3-Jun-09 14:27 
QuestionClasses, events and best practices Pin
Raybarg3-Jun-09 5:54
professionalRaybarg3-Jun-09 5:54 
AnswerRe: Classes, events and best practices Pin
S. Senthil Kumar3-Jun-09 10:41
S. Senthil Kumar3-Jun-09 10:41 
GeneralRe: Classes, events and best practices [modified] Pin
Raybarg3-Jun-09 20:28
professionalRaybarg3-Jun-09 20:28 
GeneralRe: Classes, events and best practices Pin
S. Senthil Kumar3-Jun-09 23:29
S. Senthil Kumar3-Jun-09 23:29 
Questionmysql connector Pin
benjamin yap3-Jun-09 4:59
benjamin yap3-Jun-09 4:59 
AnswerRe: mysql connector Pin
Ennis Ray Lynch, Jr.3-Jun-09 5:03
Ennis Ray Lynch, Jr.3-Jun-09 5:03 
GeneralRe: mysql connector Pin
benjamin yap3-Jun-09 5:13
benjamin yap3-Jun-09 5:13 
GeneralRe: mysql connector Pin
Ennis Ray Lynch, Jr.3-Jun-09 5:14
Ennis Ray Lynch, Jr.3-Jun-09 5:14 
GeneralRe: mysql connector Pin
benjamin yap3-Jun-09 5:21
benjamin yap3-Jun-09 5:21 
AnswerRe: mysql connector Pin
Christian Graus3-Jun-09 10:32
protectorChristian Graus3-Jun-09 10:32 
QuestionArguments! C# Pin
Baeltazor3-Jun-09 3:51
Baeltazor3-Jun-09 3:51 
Hey there Smile | :)

I have a richtext editor i've made in C#. It's just about finished. Everything works very well and i love it lol. But there's one thing I don't know how to do yet and that is inside the Program.cs file when I send the file contents of the file that was opened from within a folder in windows explorer to the richtextbox control on Form1 (SPage)... I don't know how to retreive the name of the file using the args... I don't know how to explain it I'm very confused atm... Here's my code, it works beautifully, I just need to be able to grab the filename and pass it to the Tabpage that it creates and set the Text property of the selected tab to the name of the file.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace J.T_Notes
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();

            if (args.Length >= 1)
            {
                SPage frm = new SPage(); // create a ref for form page.

                System.IO.StreamReader myFile = new System.IO.StreamReader(args[0]);
                
                string line = "";

                try
                {
                    line = myFile.ReadToEnd();

                    if (line.Contains(@"{\rtf1"))
                    {
                        frm.Tb.Rtf = line;
                        myFile.Close();
                    }
                    else
                    {
                        frm.Tb.Text = line;
                        myFile.Close();
                    }
                }
                catch
                {
                    // dunno y not working.
                    MessageBox.Show("damn... this ain't workin' so good!",
                        "J.T Notes 3.1");

                    Application.Restart();
                }
                Application.Run(frm);
            }
            else
                Application.Run(new SPage());
        }
    }
}



Does anybody know how to do this and/or have any suggestions or links to a tutorial/article as I am completely lost. Any help would be greatly appreciated! Thanks Smile | :)

regards,
j.t
AnswerRe: Arguments! C# Pin
Pete O'Hanlon3-Jun-09 3:59
mvePete O'Hanlon3-Jun-09 3:59 
GeneralRe: Arguments! C# Pin
Baeltazor3-Jun-09 4:04
Baeltazor3-Jun-09 4:04 
GeneralRe: Arguments! C# Pin
Nagy Vilmos3-Jun-09 4:12
professionalNagy Vilmos3-Jun-09 4:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.