• ベストアンサー
※ ChatGPTを利用し、要約された質問です(原文:TreeGridViewへの入力カラム追加)

TreeGridViewへの入力カラム追加

このQ&Aのポイント
  • TreeGridViewへの入力カラムを追加する方法を教えてください
  • TreeGridViewのソースをダウンロードし、自分のプログラムに組み込みました。しかし、追加したカラムに入力することができません
  • nameColumnに入力可能にする方法を教えてください

質問者が選んだベストアンサー

  • ベストアンサー
  • redfox63
  • ベストアンサー率71% (1325/1856)
回答No.1

TreeGridView1のEditModeプロパティは何になっていますか? EditProgrammaticallyになっている場合はダブルクリックでの編集は出来ないようです BeginEditを呼ぶようにプログラミングしないといけない見たいですよ 当方の環境ではダブルクリックというより シングルクリックを2回といった感じです 行を選択、項目をクリックといった感じです

mishsnow
質問者

お礼

ありがとうございます!! ご回答のおかげで無事解決できました!

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

関連するQ&A

  • VisualStudio 2008 Express

    無料でネットからダウンロードしたVisualStudio 2008 Express Edition のフォームをつかってGUIの勉強をしています。 非情報系学生のための C/C++ 入門 というサイトにある コースの 「第三回  GUI と画像処理プログラミング 」をやってみましたが、フォーム上のボタンを押せばメッセージボックスが出てくるはずなのに、何も起こりません。 何が原因なのかわかりません。詳しい方、どうか知恵を貸してください。  ちなみにそのサイトのアドレスは以下のとおりです。 http://brain.cc.kogakuin.ac.jp/~kanamaru/lecture/prog1/index.html ボタンをフォームに貼り付けると自動的に生成されるイベントハンドラーに、自分の追加した部分も含めたヘッダーファイルの内容を下に乗せておきます。 // *************************** // Form1.h file #pragma once namespace MyGUI_NET { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; /// <summary> /// Form1 の概要 /// /// 警告: このクラスの名前を変更する場合、このクラスが依存するすべての .resx ファイルに関連付けられた /// マネージ リソース コンパイラ ツールに対して 'Resource File Name' プロパティを /// 変更する必要があります。この変更を行わないと、 /// デザイナと、このフォームに関連付けられたローカライズ済みリソースとが、 /// 正しく相互に利用できなくなります。 /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: ここにコンストラクタ コードを追加します // } protected: /// <summary> /// 使用中のリソースをすべてクリーンアップします。 /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; protected: protected: private: /// <summary> /// 必要なデザイナ変数です。 /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// デザイナ サポートに必要なメソッドです。このメソッドの内容を /// コード エディタで変更しないでください。 /// </summary> void InitializeComponent(void) { this->button1 = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // // button1 // this->button1->BackColor = System::Drawing::Color::PeachPuff; this->button1->Location = System::Drawing::Point(34, 35); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(185, 55); this->button1->TabIndex = 0; this->button1->Text = L"click me"; this->button1->UseVisualStyleBackColor = false; // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(292, 266); this->Controls->Add(this->button1); this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); } #pragma endregion // event handler for button 1 private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox::Show("こんにちは"); // 自分が追加した一行 } }; } //****************** どうぞよろしくお願いします。

  • J#でjava.awt.frameからSystem.Windows.Forms.Formを呼び出す

    Windows XP SP2にVisual J# 2005 Express Editionをインストールして使用しています。 今まで、J2SE 5.0を使用していて、GUIの部分はSwingで書いていたのですが、J#に移行したいと思っています。 J#はSwingを一部サポートしているのですが、JTextPaneが使えないので、その部分だけ、J#のSystem.Windows.Forms.FormとSystem.Windows.Forms.RichTextBoxを使って作り替えようと思っています。そこで、java.awt.Frameにjava.awt.Buttonを配置してそのボタンが押されたときにFormを表示させたいのですが、Form.Show()すると表示されたFormがきちんと表示されず、フリーズしてしまいます。 以下に、ソースコードを載せますので、問題点を指摘していただけたら幸いです。 import System.Windows.Forms.Form; import System.Windows.Forms.RichTextBox; import System.Drawing.*; import System.ComponentModel.*; import java.awt.*; import java.awt.event.*; class test implements ActionListener{  Frame frame;  Form f;  RichTextBox tb;  Button b;  IContainer components;  void testGUI(){   this.b=new Button("test");   this.b.addActionListener(this);   this.tb=new RichTextBox();   this.f=new Form();   this.f.get_Controls().Add(this.tb);   this.f.set_Name("Form1");   this.f.set_Text("Form1");   this.frame=new Frame();   this.frame.setSize(100,100);   this.frame.add(this.b);   this.frame.show();  }  public static void main(String[] args){   test2 t2=new test2();   t2.testGUI();  }  private void f_Load(Object sender, System.EventArgs e){}  public void actionPerformed(ActionEvent ae){   if(ae.getSource()==this.b){    this.f.Show();   }  } }

  • キー入力が反応しません。

    VisualStudio2005のC#になります。 ボタンを押す ラベルに文章 ボタン消える Enterキー押す ラベルの文章が変わる という処理を行いたいのですが、”Enterキー押す”以下が実行されません。なぜなのでしょうか?どうすれば実行されるのでしょう。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace 消す { public partial class Form1 : Form { private bool EnterKeyDown; public Form1() { InitializeComponent(); } private void Form1_KeyDown(object sender, KeyEventArgs e) { if (EnterKeyDown == false) { EnterKeyDown = true; label1.Text = "押したよ"; } else { EnterKeyDown = false; label1.Text = "押したよ2"; } } private void button1_Click(object sender, EventArgs e) { button1.Visible = false; } } }

  • C#

    form2で入力した文字を form1で表示させたいのですが、上手くいきません。プログラムの(文字制限の為)一部だけ のせます。アドバイス よろしくお願いします。 まず、form1 public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.Label label1; private Form2 form2; /// <summary> /// 必要なデザイナ変数です。 /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Windows フォーム デザイナ サポートに必要です。 // InitializeComponent(); form2= new Form2(); label1.Text=string.Format("{0}",form2.s); // // TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。 // } static void Main() { Application.Run(new Form1()); } private void menuItem2_Click(object sender, System.EventArgs e) { if (form2.ShowDialog(this) == DialogResult.OK) this.Refresh(); } } 次にform2です private void button1_Click(object sender, System.EventArgs e) { string s; s=(string)textBox1.Text; } public string s { get { return s; } }

  • C# datagridviewの使い方

    vs community2017 ver15.1でC#を独学しています。 親フォームで取得したデータを子フォームにあるdatagridviewで表示させたいのですが、うまくいきません。 子formのdesigner.csでstaticをpublicにしています。 public System.Windows.Forms.DataGridView dataGridView1; public System.Windows.Forms.DataGridViewTextBoxColumn Column1; public System.Windows.Forms.DataGridViewTextBoxColumn Column2; public System.Windows.Forms.DataGridViewTextBoxColumn Column3; public System.Windows.Forms.DataGridViewTextBoxColumn Column4; 親formのcsファイルで以下のように使用しています。 Form2 kofm = new Form2(); kofm.dataGridView1[0, 0].Value = "aaa"; kofm.StartPosition = FormStartPosition.CenterScreen; kofm.ShowDialog(); これで実行すると、以下のエラーになります。 System.ArgumentOutOfRangeException が発生しました HResult=0x80131502 Message=インデックスが範囲を超えています。負でない値で、コレクションのサイズよりも小さくなければなりません。 親フォームのボタンをクリックし、子フォームのdatagridviewに表示させるにはどのようにすればよろしいのでしょうか? 教えてください。 よろしくお願いします。

  • フォームを閉じる方法

    VC#2008ExpressEditionを使用して仕事で使う在庫管理ソフトを作成しています。 まず、ウェルカムページが開いて、その後認証ページが開くように作っていますが、認証ページが開いたのと同時にウェルカムページを閉じたいのですが、閉じることが出来ません。どなたか教えて下さい。 ウェルカムページのコーディング using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace zaiko { public partial class welcomeForm : Form { public welcomeForm() { InitializeComponent(); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Form mainForm = new mainForm(); mainForm.Show(); } } } 認証ページのコーディング using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace zaiko { public partial class mainForm : Form { public mainForm() { InitializeComponent(); } private void mainForm_Load(object sender, EventArgs e) { Form welcomeForm = new Form(); welcomeForm.Close(); } } }

  • C# パネルの中にボタンを動的に配置したいです

    C# でフォームの中にパネルを置き、そのパネルの中に、ボタンを動的に配置したいです。 以下のページにあるようなことを、パネル内にしたいです。 動的にコントロールの配列を作成する http://dobon.net/vb/dotnet/control/buttonarray.html ---------------------- [C#] //ボタンコントロール配列のフィールドを作成 private System.Windows.Forms.Button[] testButtons; //フォームのLoadイベントハンドラ private void Form1_Load(object sender, System.EventArgs e) { //ボタンコントロール配列の作成(ここでは5つ作成) this.testButtons = new System.Windows.Forms.Button[5]; //ボタンコントロールのインスタンス作成し、プロパティを設定する this.SuspendLayout(); for (int i = 0; i < this.testButtons.Length; i++) { //インスタンス作成 this.testButtons[i] = new System.Windows.Forms.Button(); //プロパティ設定 this.testButtons[i].Name = "Button" + i.ToString(); this.testButtons[i].Text = i.ToString(); this.testButtons[i].Size = new Size(30, 30); this.testButtons[i].Location = new Point(i * 30, 10); //イベントハンドラに関連付け this.testButtons[i].Click += new EventHandler(this.testButtons_Click); } //フォームにコントロールを追加 this.Controls.AddRange(this.testButtons); this.ResumeLayout(false); } //Buttonのクリックイベントハンドラ private void testButtons_Click(object sender, EventArgs e) { //クリックされたボタンのNameを表示する MessageBox.Show(((System.Windows.Forms.Button) sender).Name); } ----------------------------- プログラムの初心者です。宜しくお願いいたします。

  • C#の配列の定数

    BCCを使用していたのですが、最近VS2013でC#を勉強し始めました フォームの指定した位置にいくつかのボタンを設置し、あらかじめ定義しておいた テーブルからボタンのtextを表示したいと思い、以下のようにコーディングしたのですが エラーが出てしまい思ったような結果に持って行くことができません C#ならこうした方がいいという指摘も含めて どうやるのがいいのか ご教授ください 足りない情報があれば追加します ちなみにまだテスト段階だから2列定義して1列しか表示するようにしかなってません ----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace haneda { public partial class Form1 : Form { private Button[] buttons; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { int i; //ボタンコントロール配列の作成 this.buttons = new Button[table.MAX_R]; for (i = 0; i < buttons.Length; i++) { //ボタンコントロールのインスタンス作成 this.buttons[i] = new Button(); //プロパティ設定 this.buttons[i].Name = "btn" + i.ToString(); this.buttons[i].Text = table.roomNo[1, i]; <=ここがエラー this.buttons[i].Top = table.roomX01[i]; <=ここがエラー this.buttons[i].Left = table.roomY01[i]; <=ここがエラー this.buttons[i].Click += new System.EventHandler(button_Click); //コントロールをフォームに追加 this.Controls.Add(this.buttons[i]); } } private void button_Click(object sender, System.EventArgs e) { Button btn = (Button)sender; MessageBox.Show(btn.Name); } } public class define { public const bool IGNORE = false; //非表示 public const bool EFFECT = true; //表示 /* 最大値 */ public const int MAX_F = 2; //フロア数 public const int MAX_R = 3; //ルーム数 } public class table { /* ナンバー */ public readonly string[,] roomNo = new string[define.MAX_F, define.MAX_R] { { "101", "102", "103"}, { "201", "202", "203"} } /* 表示・非表示 */ public readonly bool[,] effectRoom = new bool[define.MAX_F, define.MAX_R] { {EFFECT, IGNORE, EFFECT}, {EFFECT, EFFECT, EFFECT} } public readonly int[] roomX01 = new int[define.MAX_R] { 5, 70, 135 } public readonly int[] roomY01 = new int[define.MAX_R] { 100, 100, 100 } } }

  • C# フォームを閉じてもプログラムが終了しない

    前略 ・C#の初心者です。 ・下記のようなプログラムを作りたいと思っています。プログラムは<作りたいプログラム>の仕様どうりに動作していますが、Form1のFormClosingイベントに Application.Exit()を追加しないと フォーム1で "X"(閉じる)をクリックしても(フォームは非表示になりますが)プログラムが終了しません。プログラムでどこかおかしな部分があると思っています。Application.Exit()を追加しないでもプログラムを終了する方法を教えてください。 <作りたいプログラム> (1)Form1 のbutton1をクリックすると新しいForm2が作成され表示される。Form2が表示されるとForm1は非表示となる。 (2)Form2 のbutton1をクリックするとForm2が非表示となりForm1が表示される。 (3)Form1 の "X"(閉じる)をクリックしてプログラムを終了する。 //Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace formClose { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.Show(); //フォーム2を表示 this.Hide(); //フォーム1を非表示 } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Application.Exit(); //アプリケーション終了 } } } //Form2.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace formClose { public partial class Form2 : Form { Form1 form1 = new Form1(); public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.Close(); //フォーム2を閉じる } private void Form2_FormClosing(object sender, FormClosingEventArgs e) { form1.Show(); //フォーム1を表示する } } } 以上

  • C# csvをexcelシートのように No.2

    VS2017でC#を独学しています。 https://okwave.jp/qa/q9340465.html 上記で質問したように、Tabcontrolの中にタブページごとにdatagridview表を挿入し、 そこにCSVファイルを表示させたいと思っています。 今、このような形で動きますが、あってますでしょうか? 下記コードの回りくどい部分や、おかしい部分など教えていただけるとうれしいです。 よろしくお願いします。 private System.Windows.Forms.DataGridView dg; private TabPage tabPage9; private void button3_Click(object sender, EventArgs e) { tabPage9 = new TabPage(); tabPage9.Text = "Tab" + i; tabControl1.TabPages.Add(tabPage9); // 追加したタブページにdatagridviewを追加する。 this.dg = new System.Windows.Forms.DataGridView(); this.dg.Name = "dg"; tabPage9.Controls.Add(dg); this.dg.Dock = DockStyle.Fill; this.dg.Columns.Add("", "No"); this.dg.Columns.Add("", "Name"); this.dg.Rows.Add(3); this.dg[0, 0].Value = "aaa"; this.dg[0, 1].Value = "bbb"; i++; }