Click here to Skip to main content
15,915,603 members
Home / Discussions / C#
   

C#

 
AnswerRe: Invoke xsd.exe thru code Pin
kubben17-Apr-07 5:38
kubben17-Apr-07 5:38 
GeneralRe: Invoke xsd.exe thru code Pin
nikanth18-Apr-07 2:39
nikanth18-Apr-07 2:39 
GeneralRe: Invoke xsd.exe thru code Pin
kubben18-Apr-07 2:54
kubben18-Apr-07 2:54 
QuestionApp config files Pin
eliea17-Apr-07 5:18
eliea17-Apr-07 5:18 
AnswerRe: App config files Pin
eliea17-Apr-07 5:19
eliea17-Apr-07 5:19 
QuestionCannot get data saved to my SQL dbase Pin
tvance92917-Apr-07 5:01
tvance92917-Apr-07 5:01 
AnswerRe: Cannot get data saved to my SQL dbase Pin
mdv11321-Apr-07 10:25
mdv11321-Apr-07 10:25 
QuestionCreating a console typewriter-like program Pin
sharpiesharpie17-Apr-07 5:01
sharpiesharpie17-Apr-07 5:01 
I want to make a typewriter like program (you know, writes a string 1 letter at a time), so I tried to use a timer but the timer elapsed event has to be static, so then you don't have access to global variables \=

I tried this but it doesn't work:

<br />
        public string myString = "hello all";<br />
        public int i=0;<br />
        static void Main(string[] args)<br />
        {<br />
            System.Timers.Timer t = new System.Timers.Timer(200);<br />
            t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed);<br />
            t.Start();<br />
            Console.Read();<br />
        }<br />
<br />
        static void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e)<br />
        {<br />
            Program mypr = new Program();<br />
            Console.Write(mypr.getString());<br />
            mypr.addToI();<br />
        }<br />
        public string getString()<br />
        {<br />
            if (i < myString.Length)<br />
                return myString[i].ToString();<br />
            else<br />
                return null;<br />
        }<br />
        public void addToI()<br />
        {<br />
            i++;<br />
        }<br />


because it creates a new instance of "Program" each time the timer is elapsed =\

so how can I do it?
AnswerRe: Creating a console typewriter-like program Pin
girm17-Apr-07 5:23
girm17-Apr-07 5:23 
QuestionSerialization issues with .NET Remoting Pin
mmfranke17-Apr-07 4:16
mmfranke17-Apr-07 4:16 
AnswerRe: Serialization issues with .NET Remoting Pin
Pete O'Hanlon17-Apr-07 4:52
mvePete O'Hanlon17-Apr-07 4:52 
GeneralRe: Serialization issues with .NET Remoting Pin
mmfranke17-Apr-07 5:12
mmfranke17-Apr-07 5:12 
GeneralRe: Serialization issues with .NET Remoting Pin
Pete O'Hanlon17-Apr-07 5:20
mvePete O'Hanlon17-Apr-07 5:20 
GeneralRe: Serialization issues with .NET Remoting Pin
mmfranke17-Apr-07 5:50
mmfranke17-Apr-07 5:50 
GeneralRe: Serialization issues with .NET Remoting Pin
Pete O'Hanlon17-Apr-07 9:52
mvePete O'Hanlon17-Apr-07 9:52 
GeneralRe: Serialization issues with .NET Remoting Pin
mmfranke17-Apr-07 9:55
mmfranke17-Apr-07 9:55 
QuestionC# Dynamically Named Array (Or arraylists) Pin
bugg_tb17-Apr-07 3:59
bugg_tb17-Apr-07 3:59 
AnswerRe: C# Dynamically Named Array (Or arraylists) Pin
Martin#17-Apr-07 4:39
Martin#17-Apr-07 4:39 
GeneralRe: C# Dynamically Named Array (Or arraylists) Pin
bugg_tb17-Apr-07 5:28
bugg_tb17-Apr-07 5:28 
GeneralRe: C# Dynamically Named Array (Or arraylists) Pin
Martin#17-Apr-07 5:32
Martin#17-Apr-07 5:32 
AnswerRe: C# Dynamically Named Array (Or arraylists) Pin
Vikram A Punathambekar17-Apr-07 4:47
Vikram A Punathambekar17-Apr-07 4:47 
QuestionUserControl and List Pin
Monty217-Apr-07 3:47
Monty217-Apr-07 3:47 
AnswerRe: UserControl and List Pin
sujithkumarsl17-Apr-07 20:06
sujithkumarsl17-Apr-07 20:06 
GeneralRe: UserControl and List Pin
Monty217-Apr-07 20:19
Monty217-Apr-07 20:19 
AnswerSolution for those who cares Pin
Monty217-Apr-07 23:18
Monty217-Apr-07 23:18 

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.