Click here to Skip to main content
15,925,661 members
Home / Discussions / Windows Forms
   

Windows Forms

 
Questionpassword change Pin
Sider8912-Jul-08 5:43
Sider8912-Jul-08 5:43 
QuestionPrinterSettings/DefaultPageSettings incredibly slow on a machine Pin
nxtwothou11-Jul-08 5:31
nxtwothou11-Jul-08 5:31 
AnswerRe: PrinterSettings/DefaultPageSettings incredibly slow on a machine Pin
Luc Pattyn11-Jul-08 6:19
sitebuilderLuc Pattyn11-Jul-08 6:19 
GeneralRe: PrinterSettings/DefaultPageSettings incredibly slow on a machine Pin
nxtwothou14-Jul-08 3:18
nxtwothou14-Jul-08 3:18 
QuestionWindows Media Encoder get installed Automatically, when i instal mu project set up. Pin
balaji_vbr10-Jul-08 21:20
balaji_vbr10-Jul-08 21:20 
GeneralSkip readonly columns in DataGridView Pin
WILLIAM MAIN10-Jul-08 11:43
WILLIAM MAIN10-Jul-08 11:43 
GeneralRe: Skip readonly columns in DataGridView Pin
Kschuler11-Jul-08 6:38
Kschuler11-Jul-08 6:38 
QuestionChild list for field RelLicData cannot be created. Pin
sam1287410-Jul-08 9:18
sam1287410-Jul-08 9:18 
QuestionPassword&Label in Windows application Pin
Sider8910-Jul-08 8:28
Sider8910-Jul-08 8:28 
AnswerRe: Password&Label in Windows application Pin
Ashfield10-Jul-08 9:33
Ashfield10-Jul-08 9:33 
GeneralRe: Password&Label in Windows application Pin
Sider8910-Jul-08 20:35
Sider8910-Jul-08 20:35 
GeneralRe: Password&Label in Windows application Pin
Ashfield10-Jul-08 21:05
Ashfield10-Jul-08 21:05 
GeneralRe: Password&Label in Windows application Pin
Sider8910-Jul-08 21:42
Sider8910-Jul-08 21:42 
GeneralRe: Password&Label in Windows application Pin
Ashfield11-Jul-08 1:14
Ashfield11-Jul-08 1:14 
Questioncreating Docklet Application for windows [modified] Pin
kimozz9-Jul-08 13:02
kimozz9-Jul-08 13:02 
AnswerRe: creating Doclet Application for windows Pin
led mike10-Jul-08 4:52
led mike10-Jul-08 4:52 
GeneralRe: creating Doclet Application for windows Pin
kimozz10-Jul-08 10:52
kimozz10-Jul-08 10:52 
GeneralRe: creating Doclet Application for windows Pin
led mike10-Jul-08 11:31
led mike10-Jul-08 11:31 
GeneralRe: creating Doclet Application for windows Pin
kimozz10-Jul-08 11:35
kimozz10-Jul-08 11:35 
GeneralRe: creating Doclet Application for windows Pin
led mike10-Jul-08 11:48
led mike10-Jul-08 11:48 
GeneralRe: creating Doclet Application for windows Pin
kimozz10-Jul-08 11:57
kimozz10-Jul-08 11:57 
Questiondatatable in Dataset nullexception Pin
sam128749-Jul-08 9:19
sam128749-Jul-08 9:19 
I am trying to use put datatable in Dataset so athat I can manuplate it .But its giving a Null Ref Exception the problem may be in lines with (-->) marked please look into it


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;


namespace Thomson.Financial.WebQA
{
public partial class frmLicenseGroups : Form
{
private SqlDataAdapter daLicGrp;
private BindingSource bsLicGrp;
private DataSet dset;
private SqlDataAdapter dLGrp1;
private SqlDataAdapter dLGrp2;
public frmLicenseGroups()
{
InitializeComponent();
this.Load += new EventHandler(frmLicenseGroups_Load);
this.btnSaveLicenseGrps.Click +=new EventHandler(btnSaveLicenseGrps_Click);
}

void LoadLicGrpDataGrid()
{

DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand("SELECT * FROM webqa_state.dbo.METADATA_LicenseGroups");
cmd.CommandType = CommandType.Text;
cmd.Connection = DBConnection.getConnection();

daLicGrp = new SqlDataAdapter(cmd);
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(daLicGrp);
daLicGrp.Fill(dt);
bsLicGrp = new BindingSource();
bsLicGrp.DataSource = dt;
dgLicenseGroups.DataSource = bsLicGrp;
dgLicenseGroups.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
}

void frmLicenseGroups_Load(object sender, EventArgs e)
{

--> dset = new DataSet("LicenseMap");
--> DataTable dt = getLtable();
--> DataTable dn = getDtable();

--> dset.Tables.Add(dt);
--> dset.Tables.Add(dn);

for (int i = 0; i < dset.Tables.Count; i++)
{
string myMessage = i.ToString() + " " + dset.Tables[i].ToString() + " ";
}

this.LoadLicGrpDataGrid();
this.treeLicencegrpView.AllowDrop = true;

this.treeLicencegrpView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter);
this.treeLicencegrpView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop);

this.dgDataItemgrp.MultiSelect = true;
this.dgDataItemgrp.MouseDown += new System.Windows.Forms.MouseEventHandler(dgview1_MouseDown);


DataRelation relLicData;
DataColumn colMaster1;
DataColumn colDetail1;

--> colMaster1 = dset.Tables["webqa_state.dbo.METADATA_LicenseGroups"].Columns["LicensegroupID"];
--> colDetail1 = dset.Tables["webqa_state.dbo.METADATA_Data_Items_LicenseGroups"].Columns["LicensegroupID"];
--> relLicData = new DataRelation("RelLicData", colMaster1, colDetail1);
--> dset.Relations.Add(relLicData);

TreeNode rootNode = new TreeNode();
rootNode.Text = "LicenseGroups";
this.treeLicencegrpView.Nodes.Add(rootNode);

foreach (DataRow row in treeViewlicencegrpID().Rows)
{
TreeNode newnode = new TreeNode();
newnode.Text = "[" + row["LicenseGroupID"].ToString() + "] " + row["Name"].ToString();
newnode.Tag = (int)row["LicensegroupID"];
treeLicencegrpView.Nodes[0].Nodes.Add(newnode);
}

TreeNode parentNode = new TreeNode();
parentNode.Text = "LicenseGroupID";
this.LicgrpTreeView.Nodes.Add(parentNode);
foreach (DataRow row in treeViewlicencegrpID().Rows)
{
TreeNode newNode = new TreeNode();
newNode.Text = "[" + row["LicenseGroupID"].ToString() + "] " + row["Name"].ToString();
LicgrpTreeView.Nodes[0].Nodes.Add(newNode);
}


TreeNode mainNode = new TreeNode();
mainNode.Text = "Eserver";
this.eserverTreeview.Nodes.Add(mainNode);
foreach (DataRow row in getEserverEtitlementSetID().Rows)
{
TreeNode newNode = new TreeNode();
newNode.Text = row["FullDeatilsESet"].ToString();
this.eserverTreeview.Nodes[0].Nodes.Add(newNode);
}
}

--> public DataTable getLtable()
{
DataTable Ltable = new DataTable("myTable");
SqlCommand cmd = new SqlCommand("SELECT * FROM webqa_state.dbo.METADATA_LicenseGroups");
cmd.CommandType = CommandType.Text;
cmd.Connection = DBConnection.getConnection();
dLGrp1 = new SqlDataAdapter(cmd);
dLGrp1.TableMappings.Add("webqa_state.dbo.METADATA_LicenseGroups","myTable");
dLGrp1.Fill(Ltable);
return(Ltable);
}

--> public DataTable getDtable()
{
DataTable Dtable = new DataTable("myTable1");
SqlCommand cmd = new SqlCommand("select *FROM webqa_state.dbo.METADATA_Data_Items_LicenseGroups");
cmd.CommandType = CommandType.Text;
cmd.Connection = DBConnection.getConnection();
dLGrp2 = new SqlDataAdapter(cmd);
dLGrp2.TableMappings.Add("webqa_state.dbo.METADATA_Data_Items_LicenseGroups","myTable1");
dLGrp2.Fill(Dtable);
return (Dtable);
}

public DataTable getEserverEtitlementSetID()
{
string cmd = "SELECT EntitlementSetID, '['+ CAST(EntitlementSetID As varchar(20))+ ']'+Name AS FullDeatilsESet from webqa_registration.dbo.ESERVER_Entitlement";
return DBConnection.getDataTable(cmd);
}

public DataTable treeViewlicencegrpID()
{
string cmd = "SELECT Name,LicenseGroupID FROM webqa_state.dbo.METADATA_LicenseGroups";
return DBConnection.getDataTable(cmd);
}

private void treeView_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}

private void treeView_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent("System.Windows.Forms.DataGridViewSelectedRowCollection", false))
{
Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);

DataGridViewSelectedRowCollection rowCollection = (DataGridViewSelectedRowCollection)e.Data.GetData("System.Windows.Forms.DataGridViewSelectedRowCollection", false);
foreach (DataGridViewRow drv in rowCollection)
{
string nodeName = ((DataRowView)drv.DataBoundItem).Row[1].ToString() + " [" + ((DataRowView)drv.DataBoundItem).Row[0].ToString() + "]";
//DestinationNode.Tag = (int)
DestinationNode.Nodes.Add(new TreeNode(nodeName));
DestinationNode.Expand();
}
}
}

private void dgview1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
DataGridView.HitTestInfo info = dgDataItemgrp.HitTest(e.X, e.Y);
if (info.RowIndex >= 0)
{
DataGridViewSelectedRowCollection rowCollection = dgDataItemgrp.SelectedRows;
if (rowCollection != null)
{
dgDataItemgrp.DoDragDrop(rowCollection, DragDropEffects.Copy);
}
}
}
}

private void btnCancel_Click(object sender, EventArgs e)
{
LoadLicGrpDataGrid();
}

private void btnSaveLicenseGrps_Click(object sender, EventArgs e)
{
SaveLicenseGroups();
}

public void SaveLicenseGroups()
{
daLicGrp.Update((DataTable)bsLicGrp.DataSource);
}

}
}
AnswerRe: datatable in Dataset nullexception Pin
Christian Graus9-Jul-08 15:41
protectorChristian Graus9-Jul-08 15:41 
GeneralRe: datatable in Dataset nullexception Pin
sam1287410-Jul-08 6:45
sam1287410-Jul-08 6:45 
Questionhow to deploy 3-tire architecture(Windows applicaion) Pin
chiranjeevi20079-Jul-08 3:10
chiranjeevi20079-Jul-08 3:10 

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.