Click here to Skip to main content
15,922,315 members
Home / Discussions / Windows Forms
   

Windows Forms

 
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 
AnswerRe: how to deploy 3-tire architecture(Windows applicaion) Pin
Christian Graus9-Jul-08 8:12
protectorChristian Graus9-Jul-08 8:12 
GeneralRe: how to deploy 3-tire architecture(Windows applicaion) Pin
chiranjeevi20079-Jul-08 20:58
chiranjeevi20079-Jul-08 20:58 
QuestionHow to call windows application with parameters using javascript in mozilla Pin
Member 38720758-Jul-08 20:42
Member 38720758-Jul-08 20:42 
AnswerRe: How to call windows application with parameters using javascript in mozilla Pin
Christian Graus9-Jul-08 7:42
protectorChristian Graus9-Jul-08 7:42 
QuestionEditing a record in DataGridView & updating the same in database Pin
aspnet2.developer8-Jul-08 18:08
aspnet2.developer8-Jul-08 18:08 
AnswerRe: Editing a record in DataGridView & updating the same in database Pin
John_Adams8-Jul-08 22:03
John_Adams8-Jul-08 22:03 
QuestionVideo encoding problem Pin
balaji_vbr8-Jul-08 5:58
balaji_vbr8-Jul-08 5:58 
AnswerRe: Video encoding problem Pin
Christian Graus8-Jul-08 6:05
protectorChristian Graus8-Jul-08 6:05 
QuestionDeleting Multiple checked rows from DataGridView with DataGridViewCheckboxColumn Pin
aspnet2.developer7-Jul-08 22:20
aspnet2.developer7-Jul-08 22:20 
AnswerRe: Deleting Multiple checked rows from DataGridView with DataGridViewCheckboxColumn Pin
Ashfield7-Jul-08 23:50
Ashfield7-Jul-08 23:50 
QuestionHow to close the parentwindow without closing child window in windows applications Pin
Member 38720757-Jul-08 20:50
Member 38720757-Jul-08 20:50 
AnswerRe: How to close the parentwindow without closing child window in windows applications Pin
N a v a n e e t h7-Jul-08 23:04
N a v a n e e t h7-Jul-08 23:04 
QuestionIntegrate desktop application with browser??? Pin
Technobizz7-Jul-08 17:53
Technobizz7-Jul-08 17:53 
AnswerRe: Integrate desktop application with browser??? Pin
N a v a n e e t h7-Jul-08 23:06
N a v a n e e t h7-Jul-08 23:06 

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.