###前提・実現したいこと
C#のWindowsFormApplicationで簡単なゲームを作ろうとしているのですがOverflowが発生するのですが原因がわからないので教えてください。
try(){}catch(){}文も効かずにとても困っています。
###発生している問題・エラーメッセージ
System.StackOverflowException
###該当のソースコード
C#
1using System; 2using System.Collections.Generic; 3using System.ComponentModel; 4using System.Data; 5using System.Drawing; 6using System.Linq; 7using System.Text; 8using System.Threading.Tasks; 9using System.Windows.Forms; 10 11namespace WindowsForm音ゲー 12{ 13 public partial class Form1 : Form 14 { 15 string[] catchcode; 16 public string[] TextBOX1 17 { 18 get 19 { 20 string[] returna = catchcode; 21 listBox1.SelectedValue.ToString(); 22 return returna; 23 } 24 set 25 { 26 listBox1.SelectedValue.ToString(); 27 } 28 } 29 public string SelectTitle 30 { 31 get 32 { 33 return listBox1.SelectedValue.ToString(); 34 } 35 36 } 37 public Form1() 38 { 39 try 40 { 41 InitializeComponent(); 42 System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(@"music/"); 43 System.IO.FileInfo[] files = di.GetFiles("*.csv", System.IO.SearchOption.AllDirectories); 44 int ib = 0; 45 while (true) 46 { 47 if (ib == files.Length) 48 { 49 break; 50 } 51 listBox1.Items.Add(System.IO.Path.GetFileNameWithoutExtension(files[ib].FullName)); 52 ib++; 53 } 54 } 55 catch (Exception e) { 56 MessageBox.Show("Error"+e); 57 } 58 } 59 60 private void Form1_Load(object sender, EventArgs e) 61 { 62 63 } 64 65 private void button1_Click(object sender, EventArgs e) 66 { 67 using (var sr = new System.IO.StreamReader("music/"+listBox1.SelectedItem + ".csv")) 68 { 69 while (!sr.EndOfStream) 70 { 71 var line = sr.ReadLine(); 72 catchcode = line.Split(','); 73 } 74 } 75 Form2 form2 = new Form2(); 76 form2.Show(); 77 } 78 79 } 80} 81
###試したこと
課題に対してアプローチしたことを記載してください
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
回答4件
あなたの回答
tips
プレビュー