Click here to Skip to main content
15,911,306 members
Home / Discussions / C#
   

C#

 
Questioncookies with web testing(web test) Pin
sreecahitu20-Sep-07 13:02
sreecahitu20-Sep-07 13:02 
Questionthe form stops Pin
som4a20-Sep-07 12:50
som4a20-Sep-07 12:50 
AnswerRe: the form stops Pin
Luc Pattyn20-Sep-07 13:05
sitebuilderLuc Pattyn20-Sep-07 13:05 
QuestionMultiTabbed WebBrowser (unique Instances) Pin
Beef Feeter20-Sep-07 12:29
Beef Feeter20-Sep-07 12:29 
AnswerRe: MultiTabbed WebBrowser (unique Instances) Pin
Scott Dorman20-Sep-07 19:20
professionalScott Dorman20-Sep-07 19:20 
GeneralRe: MultiTabbed WebBrowser (unique Instances) Pin
Beef Feeter20-Sep-07 22:26
Beef Feeter20-Sep-07 22:26 
GeneralRe: MultiTabbed WebBrowser (unique Instances) Pin
Scott Dorman21-Sep-07 4:11
professionalScott Dorman21-Sep-07 4:11 
Questionc# Images into Video file [modified] Pin
BenGriffiths20-Sep-07 11:59
BenGriffiths20-Sep-07 11:59 
AnswerRe: c# Images into Video file Pin
Christian Graus20-Sep-07 14:26
protectorChristian Graus20-Sep-07 14:26 
QuestionCVS with big C# Winforms project Pin
jesarg20-Sep-07 11:44
jesarg20-Sep-07 11:44 
AnswerRe: CVS with big C# Winforms project Pin
Paul Conrad23-Sep-07 6:42
professionalPaul Conrad23-Sep-07 6:42 
QuestionMultiple files through context menu Pin
Johan Martensson20-Sep-07 10:40
Johan Martensson20-Sep-07 10:40 
QuestionDesign pattern framework Pin
Wes Aday20-Sep-07 10:29
professionalWes Aday20-Sep-07 10:29 
AnswerRe: Design pattern framework Pin
Pete O'Hanlon20-Sep-07 10:44
mvePete O'Hanlon20-Sep-07 10:44 
GeneralRe: Design pattern framework Pin
Wes Aday20-Sep-07 11:04
professionalWes Aday20-Sep-07 11:04 
GeneralRe: Design pattern framework Pin
Pete O'Hanlon20-Sep-07 11:18
mvePete O'Hanlon20-Sep-07 11:18 
Questioneasy newbie question - SOLVED [modified] Pin
shwaguy20-Sep-07 10:27
shwaguy20-Sep-07 10:27 
I get the following error when running my code:

"A local variable named 'textOut' cannot be declared in this scope because it would give a different meaning to 'textOut', which is already used in a 'child' scope to denote something else"


namespace file_i_o<br />
{<br />
    public partial class Form1 : Form<br />
    {<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
        }<br />
<br />
        private void button1_Click(object sender, EventArgs e)<br />
        {<br />
            string path = @"c:\testc.txt";<br />
            try<br />
            {<br />
<br />
                StreamWriter textOut = new StreamWriter(new FileStream(path, FileMode.Create, FileAccess.Write));<br />
                <br />
            }<br />
           <br />
            catch(IOException ioe)<br />
            {<br />
                MessageBox.Show(ioe.Message);<br />
            }<br />
                StreamWriter textOut = new StreamWriter(new FileStream(path, FileMode.Create, FileAccess.Write));<br />
                textOut.Write("test"); //*****THIS IS WHERE MY ERROR IS*****<br />
                textOut.Close();<br />
        }<br />
    }<br />
}



If I put the "textOut.Write("test");" code in my try statement all is fine.
I think this sucks; I found that I cannot reuse textOut anywhere else in my code, this just does not seem right!

Please help and enlighten me.

Many Thanks,

Stuntman



-- modified at 18:06 Thursday 20th September, 2007
AnswerRe: easy newbie question Pin
lost in transition 20-Sep-07 10:31
lost in transition 20-Sep-07 10:31 
GeneralRe: easy newbie question Pin
Scott Dorman20-Sep-07 10:38
professionalScott Dorman20-Sep-07 10:38 
GeneralRe: easy newbie question Pin
lost in transition 20-Sep-07 10:47
lost in transition 20-Sep-07 10:47 
GeneralRe: easy newbie question Pin
Scott Dorman20-Sep-07 10:51
professionalScott Dorman20-Sep-07 10:51 
AnswerRe: easy newbie question Pin
Scott Dorman20-Sep-07 10:36
professionalScott Dorman20-Sep-07 10:36 
GeneralRe: easy newbie question Pin
Pete O'Hanlon20-Sep-07 11:26
mvePete O'Hanlon20-Sep-07 11:26 
GeneralRe: easy newbie question Pin
Scott Dorman20-Sep-07 11:32
professionalScott Dorman20-Sep-07 11:32 
AnswerRe: easy newbie question Pin
shwaguy20-Sep-07 12:06
shwaguy20-Sep-07 12:06 

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.