I am trying to bind a strongly-typed collection to a data
grid on a windows form like:
BeerInventory inventory = new BeerInventory();
inventory.Add(new Beer
("Hamms", "Hamms Brewing Co.", 3));
inventory.Add(new Beer
("Budweiser", "Anheuser-Busch", 1000));
inventory.Add(new Beer("Mulholland
Rain", "City Brewers", 113));
button1.Text = inventory[1].name;
dataGrid1.DataSource = inventory;
The grid doesn't show the records.Any idea??
Sefa 4 3967
Define "Strongly typed collection". How did you program this?
Otherwise - well - something is wrong with the colleciton OR the setup of
the grid.
--
Regards
Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
"Sefa Sevtekin" <se******@de.ibm.com.removeSpam> wrote in message
news:05****************************@phx.gbl... I am trying to bind a strongly-typed collection to a data grid on a windows form like:
BeerInventory inventory = new BeerInventory(); inventory.Add(new Beer ("Hamms", "Hamms Brewing Co.", 3)); inventory.Add(new Beer ("Budweiser", "Anheuser-Busch", 1000)); inventory.Add(new Beer("Mulholland Rain", "City Brewers", 113)); button1.Text = inventory[1].name;
dataGrid1.DataSource = inventory;
The grid doesn't show the records.Any idea??
Sefa
Hi Thomas,
Thanks for your reply. Here is my strongly-typed
collection:
public class BeerInventory :
System.Collections.CollectionBase
{
public int Add(Beer value)
{
return List.Add(value);
}
public Beer this[int index]
{
get
{
return (Beer)List[index];
}
set
{
List[index] = value;
}
}
}
I don't think there is a flaw in collection. Anything that
I have to configure on Grid???
Thanks,
Sefa -----Original Message----- Define "Strongly typed collection". How did you program
this? Otherwise - well - something is wrong with the colleciton
OR the setup ofthe grid.
-- Regards
Thomas Tomiczek THONA Software & Consulting Ltd. (Microsoft MVP C#/.NET)
"Sefa Sevtekin" <se******@de.ibm.com.removeSpam> wrote in
messagenews:05****************************@phx.gbl... I am trying to bind a strongly-typed collection to a
data grid on a windows form like:
BeerInventory inventory = new BeerInventory(); inventory.Add(new Beer ("Hamms", "Hamms Brewing Co.", 3)); inventory.Add(new Beer ("Budweiser", "Anheuser-Busch", 1000)); inventory.Add(new Beer("Mulholland Rain", "City Brewers", 113)); button1.Text = inventory[1].name;
dataGrid1.DataSource = inventory;
The grid doesn't show the records.Any idea??
Sefa
.
Hi ,
It may sound silly, but did you call DataBind() after setting the
DataSource ?
I use a lot of such binding and until now I have never had any problem.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Sefa Sevtekin" <se******@de.ibm.com.removeSpam> wrote in message
news:05****************************@phx.gbl... I am trying to bind a strongly-typed collection to a data grid on a windows form like:
BeerInventory inventory = new BeerInventory(); inventory.Add(new Beer ("Hamms", "Hamms Brewing Co.", 3)); inventory.Add(new Beer ("Budweiser", "Anheuser-Busch", 1000)); inventory.Add(new Beer("Mulholland Rain", "City Brewers", 113)); button1.Text = inventory[1].name;
dataGrid1.DataSource = inventory;
The grid doesn't show the records.Any idea??
Sefa
Whoops, sorry I did not see that part in the original post , I was thinking
of a asp.net grid :)
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Thomas Tomicek [MVP]" <t.********@thona-consulting.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... You dont have to call DataBind on a winform.
-- Regards
Thomas Tomiczek THONA Software & Consulting Ltd. (Microsoft MVP C#/.NET)
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message news:eA****************@tk2msftngp13.phx.gbl... Hi ,
It may sound silly, but did you call DataBind() after setting the DataSource ? I use a lot of such binding and until now I have never had any problem.
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Sefa Sevtekin" <se******@de.ibm.com.removeSpam> wrote in message news:05****************************@phx.gbl... I am trying to bind a strongly-typed collection to a data grid on a windows form like:
BeerInventory inventory = new BeerInventory(); inventory.Add(new Beer ("Hamms", "Hamms Brewing Co.", 3)); inventory.Add(new Beer ("Budweiser", "Anheuser-Busch", 1000)); inventory.Add(new Beer("Mulholland Rain", "City Brewers", 113)); button1.Text = inventory[1].name;
dataGrid1.DataSource = inventory;
The grid doesn't show the records.Any idea??
Sefa
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ruslan Popov |
last post by:
Hi,
I am trying to prevent an assembly being loaded from GAC and instead want it
loaded from the application's base directory. However, the assembly always
gets loaded from GAC. How to have it...
|
by: JD Kronicz |
last post by:
Hi .. I have an issue I have been beating my head against
the wall on for some time. I am trying to use late
binding for MS graph so that my end users don't have to
worry about having the right...
|
by: Zlatko Matić |
last post by:
I was reading about late binding, but I'm not completely sure what is to be
done in order to adjust code to late binding...
For example, I'm not sure if this is correct:
early binding:
Dim ws...
|
by: Oleg Subachev |
last post by:
When I try to use strongly named assembly1 that references
non-strongly named assembly2 I get the following error:
"The located assembly '<assembly2 name>' is not strongly named."
How can I...
|
by: Bruce |
last post by:
Hi, there,
I meet a problem about comboBox binding.
--------------------
Database: Northwind
Tables: 1) Products 2) Categories
I create a form (named "form1") to edit the record from...
|
by: lgbjr |
last post by:
hi All,
I've decided to use Options Strict ON in one of my apps and now I'm trying
to fix a late binding issue. I have 5 integer arrays:
dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
|
by: Steven Bolard |
last post by:
Hello,
I am trying to port my .net 1.1 application to 2.0. I am using vs2005. I am
trying to get my webservices to run and although i can compile them and and
get wsdl and service descriptions...
|
by: =?Utf-8?B?UnVzc2VsbCBQb29sZXk=?= |
last post by:
I have a .NET 2.0 Web Service that is using a strongly named .NET 1.1 dll
with a version of 1.0.1.0. If we change the version of the 1.1 dll that the
web service is using to 1.0.2.0 we get an...
|
by: Tom Gur |
last post by:
Hi,
What is early/late binding ?
|
by: Dave Burns |
last post by:
Hi,
I have a C++ managed assembly (.dll) which links to a bunch of native
libraries. Everything works fine if I don't make the managed assembly a
strongly named one.
Once I make it a strongly...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |