Click here to Skip to main content
15,886,919 members
Home / Discussions / Windows Forms
   

Windows Forms

 
QuestionNeed to SendMesssage to controls placed on some remote .NET managed processes from some simulator's process. Pin
glitteringsound14-Jul-11 12:19
glitteringsound14-Jul-11 12:19 
QuestionWhy Control.FromHandle(IntPtr) returns null in one hooked process and returns valid object of “Form”? in another hooked process? Pin
glitteringsound29-Jun-11 3:13
glitteringsound29-Jun-11 3:13 
Questionwindows datagrid drill down returns relation name [modified] Pin
Amit Sk Sharma28-Jun-11 23:50
Amit Sk Sharma28-Jun-11 23:50 
AnswerRe: windows datagrid drill down returns relation name Pin
Dave Kreskowiak29-Jun-11 1:37
mveDave Kreskowiak29-Jun-11 1:37 
GeneralRe: windows datagrid drill down returns relation name [modified] Pin
BobJanova29-Jun-11 1:59
BobJanova29-Jun-11 1:59 
AnswerRe: windows datagrid drill down returns relation name Pin
Eddy Vluggen29-Jun-11 2:59
professionalEddy Vluggen29-Jun-11 2:59 
GeneralRe: windows datagrid drill down returns relation name Pin
Dave Kreskowiak29-Jun-11 4:28
mveDave Kreskowiak29-Jun-11 4:28 
GeneralRe: windows datagrid drill down returns relation name Pin
BobJanova29-Jun-11 7:16
BobJanova29-Jun-11 7:16 
I was half right. The DataGrid (but strangely, not the DataGridView) supports drilldown through relations. Here is a test case to demonstrate:

using System.Data;
using System.Windows.Forms;

class Test {
	DataSet ds;
	
	void SetUpData(){
		ds = new DataSet();
		DataTable dt = new DataTable("lookupTarget");
		DataColumn c = new DataColumn("id", typeof(int)); dt.Columns.Add(c);
		dt.PrimaryKey = new DataColumn[]{ c };
		c = new DataColumn("desc", typeof(string)); dt.Columns.Add(c);
		ds.Tables.Add(dt);
		
		dt = new DataTable("main");
		c = new DataColumn("id", typeof(int)); dt.Columns.Add(c);
		c.AutoIncrement = true;
		dt.PrimaryKey = new DataColumn[]{ c };
		c = new DataColumn("lookup", typeof(int)); dt.Columns.Add(c);
		ds.Tables.Add(dt);
		
		DataRelation dr;
		dr = new DataRelation("testRelation", ds.Tables["main"].Columns["lookup"], ds.Tables["lookupTarget"].Columns["id"], false);
		ds.Relations.Add(dr);
		
	}
	
	void PopulateData(){
		DataRow row;
		
		DataTable lookupTarget = ds.Tables["lookupTarget"];
		DataTable main = ds.Tables["main"];
		
		row = lookupTarget.NewRow();
		row["id"] = 1;
		row["desc"] = "Some stuff";
		lookupTarget.Rows.Add(row);
		
		row = lookupTarget.NewRow();
		row["id"] = 42;
		row["desc"] = "Don't panic";
		lookupTarget.Rows.Add(row);
		
		
		row = main.NewRow();
		row["lookup"] = 1;
		main.Rows.Add(row);

		row = main.NewRow();
		row["lookup"] = 1;
		main.Rows.Add(row);

		row = main.NewRow();
		row["lookup"] = 42;
		main.Rows.Add(row);
	}
	
	Form Form {
		get {
			Form f = new Form();
			DataGrid dgv = new DataGrid();
			dgv.Dock = DockStyle.Fill;
			dgv.DataSource = ds.Tables["main"];
			f.Controls.Add(dgv);
			return f;
		}
	}
	
	static void Main(){
		Test test = new Test();
		test.SetUpData();
		test.PopulateData();
		Application.Run(test.Form);
	}
}


Change the variable 'dgv' to a DataGridView and it doesn't work any more.

I am not aware of a way to make the expansion do anything other than show a link, though.
GeneralRe: windows datagrid drill down returns relation name Pin
Dave Kreskowiak29-Jun-11 7:30
mveDave Kreskowiak29-Jun-11 7:30 
GeneralRe: windows datagrid drill down returns relation name Pin
Amit Sk Sharma29-Jun-11 2:08
Amit Sk Sharma29-Jun-11 2:08 
GeneralRe: windows datagrid drill down returns relation name Pin
Dave Kreskowiak29-Jun-11 4:50
mveDave Kreskowiak29-Jun-11 4:50 
QuestionTwin TreeView Pin
Ger Hayden11-Jun-11 22:41
Ger Hayden11-Jun-11 22:41 
AnswerRe: Twin TreeView Pin
Shameel4-Jul-11 5:19
professionalShameel4-Jul-11 5:19 
GeneralRe: Twin TreeView Pin
Ger Hayden4-Jul-11 10:21
Ger Hayden4-Jul-11 10:21 
GeneralRe: Twin TreeView Pin
Shameel4-Jul-11 18:41
professionalShameel4-Jul-11 18:41 
GeneralRe: Twin TreeView Pin
Ger Hayden4-Jul-11 21:16
Ger Hayden4-Jul-11 21:16 
GeneralRe: Twin TreeView Pin
Mycroft Holmes4-Jul-11 20:07
professionalMycroft Holmes4-Jul-11 20:07 
AnswerRe: Twin TreeView Pin
BillWoodruff16-Jul-11 20:54
professionalBillWoodruff16-Jul-11 20:54 
GeneralRe: Twin TreeView Pin
Ger Hayden16-Jul-11 23:36
Ger Hayden16-Jul-11 23:36 
Questionvb.net textspeaker Pin
damoder18-Jun-11 0:18
damoder18-Jun-11 0:18 
AnswerRe: vb.net textspeaker Pin
DaveyM698-Jun-11 0:37
professionalDaveyM698-Jun-11 0:37 
QuestionNeeds to update WinForm (seperate process) to render newly created customized controls Pin
glitteringsound2-Jun-11 13:27
glitteringsound2-Jun-11 13:27 
AnswerRe: Needs to update WinForm (seperate process) to render newly created customized controls Pin
Philippe Mori2-Jun-11 14:00
Philippe Mori2-Jun-11 14:00 
GeneralRe: Needs to update WinForm (seperate process) to render newly created customized controls Pin
glitteringsound2-Jun-11 19:56
glitteringsound2-Jun-11 19:56 
AnswerRe: Needs to update WinForm (seperate process) to render newly created customized controls Pin
BobJanova8-Jun-11 1:22
BobJanova8-Jun-11 1:22 

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.