• 締切済み

C#での質問

お世話になります。 .NET C#で開発をしております。 Oracleから取得したデータをfpSpreadシートに表現しており、 そのシート内のあるセルをダブルクリックをしたら、 その列名を変数に取得したいのですが、 うまくいきません。 下記のやり方ですと、列名ではなく、一番上の一行目のセルの 値を引っ張ってしまいます。 どなたかご親切な方、ご教授頂きたく、宜しくお願い致します。             記 private void fpSpread1_CellDoubleClick(object sender, CellClickEventArgs e) { SheetView sheet = fpSpread1.ActiveSheet; string Retumei = Convert.ToString(sheet.Cells[0,e.Column].Value); }

みんなの回答

  • wormhole
  • ベストアンサー率28% (1624/5664)
回答No.1

回答ではありませんが GrapeCity の SPREAD を使っていることを書くべきではないですか? うろ覚えですが提供されているサンプルに列名の設定などあった気がします。

miruchoko
質問者

お礼

ありがとうございます。 参考になりました。

全文を見る
すると、全ての回答が全文表示されます。

関連するQ&A

  • listBoxとTimerについて C#

    listBoxとTimerについて C# ヤフーニュースのURLをlistboxへ入れます。 そしてlistBox1の中身を画面表示させたら、次にlistBox2の中身も表示したいと思っています。 最初listBoxが1つだったときはうまく行っていたのですが、listBoxを増やすとうまく行かなくなりました。 この状態だと、listBox2の中身だけ表示させて終わってしまいます。 Timerの使い方が怪しいと思うのですが、どうでしょうか? 些細なことでも何でもいいのでご意見頂ければ助かります。 -----以下コード抜粋------ public partial class Form1 : Form { public Form1() { InitializeComponent(); } int urlindex = 0; private void Form1_Load(object sender, EventArgs e) { listBox1.AllowDrop = true; listBox1.DragEnter += new DragEventHandler(listBox1_DragEnter); listBox1.DragDrop += new DragEventHandler(listBox1_DragDrop); listBox2.AllowDrop = true; listBox2.DragEnter += new DragEventHandler(listBox2_DragEnter); listBox2.DragDrop += new DragEventHandler(listBox2_DragDrop); } private void listBox1_DragEnter(object sender, DragEventArgs e) { //URLのみ受け入れる//@ITより if (e.Data.GetDataPresent("UniformResourceLocator")) e.Effect = DragDropEffects.Link; else e.Effect = DragDropEffects.None; } private void listBox2_DragEnter(object sender, DragEventArgs e) { //URLのみ受け入れる//@ITより if (e.Data.GetDataPresent("UniformResourceLocator")) e.Effect = DragDropEffects.Link; else e.Effect = DragDropEffects.None; } private void listBox1_DragDrop(object sender, DragEventArgs e) { //ドロップされたリンクのURLを取得する//@ITより string url = e.Data.GetData(DataFormats.Text).ToString(); //結果を表示 listBox1.Text = url; //MessageBox.Show(url); //ドロップされたデータがstring型か調べる if (e.Data.GetDataPresent(typeof(string))) { ListBox target = (ListBox)sender; //ドロップされたデータ(string型)を取得 string itemText = (string)e.Data.GetData(typeof(string)); //ドロップされたデータをリストボックスに追加する target.Items.Add(url); //MessageBox.Show("表示"); } } private void listBox2_DragDrop(object sender, DragEventArgs e) { //ドロップされたリンクのURLを取得する//@ITより string url = e.Data.GetData(DataFormats.Text).ToString(); //結果を表示 listBox2.Text = url; //MessageBox.Show(url); //ドロップされたデータがstring型か調べる if (e.Data.GetDataPresent(typeof(string))) { ListBox target = (ListBox)sender; string itemText = (string)e.Data.GetData(typeof(string)); target.Items.Add(url); } } private void goButton_Click(object sender, EventArgs e) { urlindex = 0; timer1.Start(); timer2.Start(); } private void timer1_Tick(object sender, EventArgs e) { timer1.Stop(); if (listBox1.Items.Count != 0 && urlindex < listBox1.Items.Count) { string url = (string)listBox1.Items[urlindex]; webBrowser1.Navigate(url); urlindex++; } } private void timer2_Tick_1(object sender, EventArgs e) { timer2.Stop(); if (listBox2.Items.Count != 0 && urlindex < listBox2.Items.Count) { string url = (string)listBox2.Items[urlindex]; } } private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { timer1.Start(); timer2.Start(); } private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { }

  • C#について・・・

    次のようなブログラムなのですが、ラジオボタンが上手く切り替わりません。 どこを修正すると上手くいくでしょうか? <<文字数オーバーのため省略>> public Form1() { // // Windows フォーム デザイナ サポートに必要です。 // InitializeComponent(); if(isJapanStyle) { label5.Text=string.Format("0時0分0秒"); label6.Text=string.Format("0時0分0秒"); } else { label5.Text=string.Format("00:00:00"); label6.Text=string.Format("00:00:00"); } // // TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。 // <<文字数オーバーのため 省略>> static void Main() { Application.Run(new Form1()); } protected void button1_Click(object sender, System.EventArgs e) { if(isJapanStyle) { label5.Text=string.Format("{0}時{1}分{2}秒",dt.Hour,dt.Minute,dt.Second); } else { label5.Text=DateTime.Now.ToString("T"); } recTime=dt; timer2.Stop(); timer3.Start(); } private void button2_Click(object sender, System.EventArgs e) { Application.Exit(); } private void timer1_Tick(object sender, System.EventArgs e) { dt=DateTime.Now; if(isJapanStyle) { label4.Text=string.Format("{0}時{1}分{2}秒",dt.Hour,dt.Minute,dt.Second); } else { label4.Text=DateTime.Now.ToString("T"); } } private void timer3_Tick(object sender, System.EventArgs e) { keika=dt-recTime; if(isJapanStyle) { label6.Text=string.Format("{0}時間{1}分{2}秒",keika.Hours,keika.Minutes,keika.Seconds); } else { label6.Text=string.Format("{0}:{1}:{2}",keika.Hours,keika.Minutes,keika.Seconds); } } private void timer2_Tick(object sender, System.EventArgs e) { timer3.Stop(); } private void radioButton2_CheckedChanged(object sender, System.EventArgs e) { isJapanStyle=false; } private void radioButton1_CheckedChanged(object sender, System.EventArgs e) { isJapanStyle=true; } } }

  • C# 関数はどこに書くの?

    c#を始めました。 関数はどこに書けばよいのだろうと思い以下の2つのパターンを書きました。どちらも実行するとちゃんと動いています。 どちらの書き方が正しいのでしょうか?よろしくお願いいたします。 パターン1 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int a=3; int n= tasu(a); MessageBox.Show(n.ToString());   //ここに関数を書く int tasu(int a10) { return a10 - 2; } } } パターン2 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int a=3; int n= tasu(a); MessageBox.Show(n.ToString()); }   //ここに関数を書く int tasu(int a20) { return a20 -1; } }

  • C# でウインド内のマウスの位置

    private void Form1_DragDrop(object sender, DragEventArgs e) { Point p = new Point(e.X, e.Y); では、ウインドウではなく、画面でのマウス位置がpに取得されます。 ウインドウ内での位置を取得したいのですが、方法がわかりません。 よろしくお願いします。

  • 【C#】EventArgsについて

    いつもお世話になります。 C#に関して質問です。 VisualC#2008を使っています。 private void Form1_Load(object sender, EventArgs e) などで見かける、EventArgs e とは何を意味しているのでしょうか? 誰か教えていただけませんか? よろしくお願いします。

  • C#のWindowsアプリケーションのセルダブルクリックのコードについて

    今、C#のWindowsでプロジェクトのソースコードを勉強しています。 セルダブルクリックイベント処理でわからないんですが、それが次のコードです private void dgvOrder_CellDoubleClick(object sender,DataGridViewCellEventArgs e) そのイベント処理が SelectDataUpdate(2,e.RowIndex); です。  ここで、わからないのがイベント処理の()の中です。 この、2,e.Indexはどういうことですか?SelectUpdateは、選択して、更新するですよね? 詳しく教えてください。お願いします。

  • VS C# のコンテキストの動作について

    VS C# のコンテキストの動作がうまくいきません、助けてください>< List Viewのアイテムを右クリックしたときに「アイテム名を表示させる」というコンテキストを表示し、それをクリックするとアイテム名を表示させるというプログラムを組んだのですが、一度目はうまく動作するのですが、その後、List Viewのアイテムのない場所を右クリックしてもコンテキストが表示されてしまいます。 何が原因なんでしょうか? 教えてください、お願いします。 以下コード 前略 private void ListView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { ConTextMenu(); } } private void ConTextMenu() { ContextMenuStrip cms = new ContextMenuStrip(); ToolStripMenuItem menu1 = new ToolStripMenuItem(); menu1.Text = "アイテム名を表示させる"; cms.Items.AddRange(new ToolStripMenuItem[] { menu1} ); menu1.Click += new EventHandler(menu_Click); this.ContextMenuStrip = cms; } private void menu_Click(object sender, EventArgs e) { string msg = sender.ToString(); if (msg == "アイテム名を表示させる") { ListViewItem item1 = new ListViewItem(); item1 = songlist.SelectedItems[0]; iname = item1.SubItems[0].Text; MessageBox.show(iname.Tostring()); }

  • VB2005 Datagridview の仮想モードでメモリリーク

    VB2005にてDatagridviewの仮想モードを実装しています。 DataGridviewを全件ループ処理する場合にメモリが増加します。完了してもそのままメモリが減りません。これを回避する方法がありますか?CellValueNeededはメモリを消費し続けるものなのでしょうか。 実際のプログラムでは件数が多い場合にメモリの消費が止まらずメモリ不足に陥ります。 以下は単純なコードにしたサンプルです。これでもデバッグモードで動かすと起動時20Mくらいのメモリ消費がループ処理時に100Mくらいにに増えます。 ※実際の処理でバインドしているデータ(datatable等)の方をループさせるという代替案がありますが、今回はdatagridviewから行った結果のメモリ不足についてご教授いただければと思います。 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With Me.DataGridView1 .Columns.Add("Column1", "列1") .Columns.Add("Column2", "列2") .Columns.Add("Column3", "列4") .Columns.Add("Column4", "列4") .Columns.Add("Column5", "列5") .Columns.Add("Column6", "列6") .Columns.Add("Column7", "列7") .VirtualMode = True .RowCount = 100000 End With End Sub Private Sub DataGridView1_CellValueNeeded(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DataGridViewCellValueEventArgs) _ Handles DataGridView1.CellValueNeeded e.Value = e.RowIndex.ToString & "," & e.ColumnIndex.ToString End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For i As Integer = 0 To DataGridView1.Rows.Count - 1 DataGridView1.Rows(i).Cells(1).Value = DataGridView1.Rows(i).Cells(2).Value Next MsgBox("終了") End Sub

  • C# フォーム追加後、旧フォームを閉じたい

    前略 ・C#で教えてください。 ・Form1 からshowDiag()メソッドでForm2をつくります。Form2が表示されたら非アクティブとなったForm1を閉じたいのですが どのようにしたらよいのかおしえてください。  下記は、Close() メソッドで Form2側から閉じようとしたプログラムですがFrom1を閉じることができません。 よろしくお願いします。 //----------------------------------------------- namespace formClose { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.ShowDialog(); } }   public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { Form1 form1 = new Form1(); form1.Close(); //Form1が閉じない!! } private void button1_Click(object sender, EventArgs e) { this.Close(); //Form2を閉じる }    } } 以上

  • C# 2010 contextMenuStripのファンクション名の不

    C# 2010 contextMenuStripのファンクション名の不思議? まず2ケのメニューアイテムを持つcontextMenuStripを作り、それぞれのTEXTを試験1、試験3と改名します ダブルクリックするとハンドラーが出来て、その名称が(1)(2)のように TEXT名+ToolStripMenuItem_Click なります ここでいったんプロジェクトを終了して再ロードします 画像のように試験1と試験3の間に『試験3を途中に追加』を入れてダブルクリックして作ったファンクション名は前2者とは異なり (3)の如くtoolStripMenuItem1_Click となってしまいます なぜ 試験2を途中に追加ToolStripMenuItem_Click にならないのでしょうか? private void 試験1ToolStripMenuItem_Click(object sender, EventArgs e) --- (1) { } private void 試験3ToolStripMenuItem_Click(object sender, EventArgs e) --- (2) { } private void toolStripMenuItem1_Click(object sender, EventArgs e) --- (3) { } 追伸 『試験3を途中に追加』が長すぎるかと思い、『試験3』だけにしても結果は同じでした

このQ&Aのポイント
  • MFC-L2750DWでFAX受信ができない問題について相談します。一部の場合では受信操作を繰り返すことで受信できることもありますが、その日に全く受信できないこともあります。また、受信したfaxメールを確認することもできません。解決方法を教えてください。
  • MFC-L2750DWのFAX受信に関してお困りの方への詳細な解決策を紹介します。受信ができない問題にはいくつかの原因が考えられます。設定の確認や通信環境の改善などを試してみてください。
  • MFC-L2750DWのFAX受信トラブルについて詳しく教えてください。受信操作を何度も繰り返すことで受信できる場合もありますが、完全に受信できないこともあります。faxメールも確認することができません。解決方法を教えてください。
回答を見る