Click here to Skip to main content
15,902,299 members
Home / Discussions / Windows Forms
   

Windows Forms

 
QuestionHow to enumerate a ToolStripMenuItems's events Pin
hellspawnfr22-Mar-07 9:54
hellspawnfr22-Mar-07 9:54 
QuestionHelp me Pin
sureshmyway22-Mar-07 4:16
sureshmyway22-Mar-07 4:16 
QuestionText box validation Pin
Ruchi0322-Mar-07 0:49
Ruchi0322-Mar-07 0:49 
AnswerRe: Text box validation Pin
Pete O'Hanlon22-Mar-07 2:30
mvePete O'Hanlon22-Mar-07 2:30 
GeneralRe: Text box validation Pin
Ruchi0322-Mar-07 17:05
Ruchi0322-Mar-07 17:05 
QuestionHelp with a HelpButton Pin
PIEBALDconsult21-Mar-07 7:36
mvePIEBALDconsult21-Mar-07 7:36 
AnswerRe: Help with a HelpButton Pin
Mike Dimmick22-Mar-07 5:50
Mike Dimmick22-Mar-07 5:50 
Questionapplication is not starting up at windows startup Pin
sainyam20-Mar-07 22:14
sainyam20-Mar-07 22:14 
AnswerRe: application is not starting up at windows startup Pin
Tirthadip20-Mar-07 23:42
Tirthadip20-Mar-07 23:42 
AnswerRe: application is not starting up at windows startup Pin
Dave Kreskowiak21-Mar-07 3:54
mveDave Kreskowiak21-Mar-07 3:54 
QuestionQuestion about C++ and C# ... Pin
Yanshof20-Mar-07 20:23
Yanshof20-Mar-07 20:23 
AnswerRe: Question about C++ and C# ... Pin
Christian Graus23-Mar-07 4:44
protectorChristian Graus23-Mar-07 4:44 
QuestionHow to define a visual scheme for a GUI *including* text? Pin
KeironN20-Mar-07 0:59
KeironN20-Mar-07 0:59 
AnswerRe: How to define a visual scheme for a GUI *including* text? Pin
Pete O'Hanlon20-Mar-07 1:46
mvePete O'Hanlon20-Mar-07 1:46 
GeneralRe: How to define a visual scheme for a GUI *including* text? Pin
KeironN20-Mar-07 8:11
KeironN20-Mar-07 8:11 
QuestionDataGridView not updating when DataSource updates Pin
mmfranke19-Mar-07 9:56
mmfranke19-Mar-07 9:56 
Hi.

I'm new to ADO.NET, and clearly this question has been asked in different forms before, but nothing I'm reading is working. I'm writing a little sample Windows Forms app that is supposed to display the contents of a table in a database. I've got a simple "add row" button to add a new row, and I'd like to see my DataGridView show the changes when the row is added. The row gets added, but my DataGridView doesn't show it. Shouldn't I be able to register for an event that is fired when my database is updated (or is my DataSet?).

I've tried calling EventsTableAdapter.Update, EventsBindingSource.ResetBindings, DataGridView.Refresh... all to no avail.

Relevant source code to follow...

public partial class Viewer : Form
{
private long m_NextEventID = 1;

public Viewer()
{
InitializeComponent();
}

private void Viewer_Load(object sender, EventArgs e)
{
this.eventsTableAdapter.Fill(this.dDBDataSet.Events);
}

// called on button click, to add a new row to my database.
private void m_NewEasyEntryButton_Click(object sender, EventArgs e)
{
this.eventsTableAdapter.Insert( m_NextEventID++, DateTime.Now,
DateTime.Now, false, 1, "Wrong Number", "This is a test");

// not working?!!
this.eventsTableAdapter.Update(this.eventsTableAdapter.GetData());
this.eventsBindingSource.ResetBindings(false);
this.m_DDBGridView.Refresh();
}
}

private void InitializeComponent()
{
...
this.eventsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dDBDataSet = new DiagViewer.DDBDataSet();
this.eventsTableAdapter = new DiagViewer.DDBDataSetTableAdapters.EventsTableAdapter();
this.m_NewEasyEntryButton = new System.Windows.Forms.Button();
this.m_UpdateNowButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.m_DDBGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.eventsBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dDBDataSet)).BeginInit();
this.SuspendLayout();
//
// m_DDBGridView
//
this.m_DDBGridView.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.eventsBindingSource, "ID", true));
this.m_DDBGridView.DataSource = this.eventsBindingSource;
//
// eventsBindingSource
//
this.eventsBindingSource.DataMember = "Events";
this.eventsBindingSource.DataSource = this.dDBDataSet;
//
// dDBDataSet
//
this.dDBDataSet.DataSetName = "DDBDataSet";
this.dDBDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// eventsTableAdapter
//
this.eventsTableAdapter.ClearBeforeFill = true;
//
// m_NewEasyEntryButton
//
this.m_NewEasyEntryButton.Location = new System.Drawing.Point(104, 310);
this.m_NewEasyEntryButton.Name = "m_NewEasyEntryButton";
this.m_NewEasyEntryButton.Size = new System.Drawing.Size(75, 23);
this.m_NewEasyEntryButton.TabIndex = 1;
this.m_NewEasyEntryButton.Text = "Easy Entry";
this.m_NewEasyEntryButton.UseVisualStyleBackColor = true;
this.m_NewEasyEntryButton.Click += new System.EventHandler(this.m_NewEasyEntryButton_Click);

}




AnswerRe: DataGridView not updating when DataSource updates Pin
RabidHamster19-Mar-07 14:49
RabidHamster19-Mar-07 14:49 
GeneralRe: DataGridView not updating when DataSource updates Pin
mmfranke20-Mar-07 3:00
mmfranke20-Mar-07 3:00 
GeneralRe: DataGridView not updating when DataSource updates Pin
mmfranke20-Mar-07 3:09
mmfranke20-Mar-07 3:09 
QuestionHow to convert existing C# Windows Application to C# Web Application.. Pin
MPS_DotNet18-Mar-07 21:08
MPS_DotNet18-Mar-07 21:08 
AnswerRe: How to convert existing C# Windows Application to C# Web Application.. Pin
Colin Angus Mackay19-Mar-07 1:19
Colin Angus Mackay19-Mar-07 1:19 
AnswerRe: How to convert existing C# Windows Application to C# Web Application.. Pin
Dave Kreskowiak19-Mar-07 1:43
mveDave Kreskowiak19-Mar-07 1:43 
QuestionUse Reflection to control winforms user permissions? Pin
nzmike18-Mar-07 20:21
nzmike18-Mar-07 20:21 
AnswerRe: Use Reflection to control winforms user permissions? Pin
Pete O'Hanlon19-Mar-07 0:27
mvePete O'Hanlon19-Mar-07 0:27 
GeneralRe: Use Reflection to control winforms user permissions? Pin
nzmike19-Mar-07 0:48
nzmike19-Mar-07 0:48 

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.