I have experienced that it may work without invoke on one machine but it doesn't work on other machines (and took a long time trying to find that out with the assumption that part was not the problem). So it's better to use invoke regardless.
darkelv
Posts
-
Multithreading with task in .net 4. Strange things. -
How to spread traffic on a tableDatabase Snapshot? http://msdn.microsoft.com/en-us/library/ms175876.aspx[^] Also consider pre-generate the commonly used ad-hoc queries with heavy usage on the database so as not to tie down the actual database.
-
Combobox large DataUnfortunately Microsoft assumes Textboxes with AutoComplete are preloaded with all data. With dynamically populated data items sometimes the application crash with an uncatchable exception. http://social.msdn.microsoft.com/Forums/en/winforms/thread/e599b2e2-3cda-43ad-b15f-a69b4fea1a75[^]
-
open form as a tab in windows applications -
Pop Out Side Menu (Visual Studio Style)Visual Studio IDE like Dock Container[^] The main area will become a MDI, though.
-
Where is saved connection string for DataSetpolzovat79 wrote:
- probably connection string is saved in another place?
I always manually set the connection string to the data adapter instead of depending on the connection string in the auto-generated config file.
-
Where is saved connection string for DataSetDidn't realize we can do that now, probably new in 2010? Sometime we have to use dataset, for report, and they LIKE to create connection string in the config file.
-
Windows or Console application target for Windows Service?I would arrange all the stuff that you want to run as the service into another class project. Then you can have the Windows Service project reference to this project for actual usage, and create console app project or windows app project that reference the class project for debugging.
-
Dataset and Crystal ReportsYou can "pull" data directly from source without using needing to use dataset. You should only passing the datatables that are needed for each report, so whether 3 or 300 reports it should not matter, unless you are talking about generating 300 reports all at once.
-
Any way to access Parent Form From a class?You can if you set a reference to the form in Class1 but that is a very bad design, unless Class1 is strictly meant as a helper class for that form. Class1 is not an inherited Control class like ctrl1, so it doesn't have Parent property. You will have to define the Control type property and set the property accordingly. Beside you won't be able to access to the combobox of the form unless you set it to public, which is another bad design.
-
Control Binding of a bool isn't updatingYou'll need to implement the OnBoolValueChanged event or OnPropertyChanged after the boolValue = value assignment. http://krisvandermotten.wordpress.com/2006/10/19/properties-with-property-changed-event/[^] http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/1e742062-bf41-48cf-bd2f-54bdc9c5b78d[^] Personally I prefer the OnXXXChanged because I'd rather not write a gigantic switch in the OnPropertyChanged handler.
-
T9 predictive text in Windows FormsYes definitely possible, though probably not entirely in .NET, and don't think there are API beside the standard Win32 API, and you got to code most of the libraries. You'll need a light and efficient database for the dictionary, an algorithm to retrieve the words fast, an algorithm to account for the most recent used words, adding and removing words from the dictionary. You'll need some way to hook the keypress, and sending the character or control characters (backspace, etc) to the control. Did a Palm version for a friend's company for the keyboard, they did the windows mobile version using C++. Though without much capital, the product is currently sort of dead. :( http://www.osnews.com/story/15389/Review-TenGO-2.0-and-TenGO-Thumb[^]
-
How do I get a datagrid to only show certain columns from a dataset?If someone added another column, or insert a column before the firstcolumn, the datagridview will display wrongly. Generally I will define the columns to be displayed and their order, instead of hiding the columns that I do not want to display.
-
How do I get a datagrid to only show certain columns from a dataset?Define only the columns that you want to display in the datagridview:
this.dataGridView.AutoGenerateColumns = false;
this.dataGridView.Columns.Clear();
this.dataGridView.Columns.AddRange(GetGridViewColumns());private DataGridViewColumn[] GetGridViewColumns()
{
DataGridViewTextBoxColumn id = new DataGridViewTextBoxColumn();
id .DataPropertyName = "ID";
id .HeaderText = "ID";
id .Name = "ID";
id .SortMode = DataGridViewColumnSortMode.Automatic;
id .ReadOnly = true;
id .Width = 100;
id .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
id .DefaultCellStyle.Format = "";DataGridViewTextBoxColumn name= new DataGridViewTextBoxColumn();
name.DataPropertyName = "Name";
name.HeaderText = "Name";
name.Name = "Name";
name.SortMode = DataGridViewColumnSortMode.Automatic;
name.ReadOnly = true;
name.Width = 100;
name.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
name.DefaultCellStyle.Format = "";return new DataGridViewColumn[] { id, name };
} -
First .Net project suggestionsWhy not do something that is related to your current work, for example, a problem tracking system, that log date/time/description of problem, who raised the problem, who and when solved the problem, Slowly you can enhance it to let user raise the problems (multi-user environment), categorize the problems, let manager to assign it to your colleagues (workflow), and generate reports on the time taken to solve the problems base on categories, etc etc.
-
Method overloadingMethod1(1d,1d)?
-
Windows forms application popup dialog?Mattzimmerer wrote:
I simply had my main form launch another form giving its self as a parameter... problem solved!!!
That is probably the worst way to do it. Passing Data Between Forms[^]
-
DataGridView problem with cell coloring [modified]You should check the value from the data source itself, not datagridview's cells. Subscribe to the datagridview's CellFormatting event, then in the handler get the DataBoundItem (object, datarow etc) and set color base on the DataBoundItem's data itself. I'm binding to collection of object, btw, so YMMV.
private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
string dataPropertyName = this.dataGridView.Columns[e.ColumnIndex].DataPropertyName;
ObjectType theObject;
switch (dataPropertyName)
{
case "ColumnName":
theObject = (ObjectType)this.dataGridView.Rows[e.RowIndex].DataBoundItem;// Set the color base on theObject's property mapped to dataPropertyName break; } }
-
DataSourceUpdateModeTry using false instead of true
this.textBox1.DataBindings.Add("Text", o, "TheProp", false, DataSourceUpdateMode.OnPropertyChanged, string.Empty);
-
Serialization of collecitonhave you tried wrap your collection in a serializable class? http://edinkapic.blogspot.com/2006/10/how-to-serialize-collection.html[^]