|
you can copy the dataTable that youve bound to the DataGridView, assuming thats where the data came from...
DataTable myNewDataTable = (DataTable)dataGridView.DataSource;
hope that helps
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
My bad, I forgot to mention that the source is loaded with an ancient ResultSet and the datagridview is built by setting the values, not via a DataTable or DataSet (which have Clone and Copy methods...)
thanks.
|
|
|
|
|
then ehy not build a DataTable with your result set and then bind it to the DataGridView?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
more or less the road I'm heading to right now. thanks.
|
|
|
|
|
any time
good luck!
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Anyone know how I can validate the Add method of a List<> property I have on a class short of overriding the Add method with a custom class?
e.g.
private List<string> stringList
public List<string> StringList
{
get
{
return stringList;
}
set
{
// Want to do validation here but isn't fired by Add method....
}
}
Thanks for any help on offer....
|
|
|
|
|
You need to create your class which wraps List<<>. Write your own "Add" method, do validation there before you add to underlying list.
RichardContact-1 wrote: set
{
// Want to do validation here but isn't fired by Add method....
}
This won't fire. When you call YourObject.StringList.Add() , get is executing, not set. get returns List<> instance and you add item to that. If you were doing YourObject.StringList = new List<string> , set will get executed.
|
|
|
|
|
|
hey guys
how do i enable double buffering on a specific panel?
where exactly do i put this?
SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw,
true);
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
myPanel.SetStyle(....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i tried that before posting... its not showing up in intellisence... is there some assembly i should be referencing(using blah.blahblah;)?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
It's a protected method so usually it doesn't appear in Intellisense. If you're authoring a custom control then you typically put the code into the constructor:
public MyControl()
{
base.SetStyle();
}
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Ed.Poore wrote: If you're authoring a custom control
indeed i am
i tried that but it didnt work... here is my constructor...
public BreakClockControl()
{
InitializeComponent();
base.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw,
true);
base.UpdateStyles();
}
note: im painting on a panel thats on the control, not the control itself, might that be the problem?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Yes, in all likely hood. You'd have to enable it on the panel as well. You should be able to call it without having the intellisense - try it and see if it compiles.
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
i got it to work like so
public class doubleBufferPanel : Panel
{
public doubleBufferPanel()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw,
true);
this.UpdateStyles();
}
}
then i replaced the panel with the doubleBufferPanel, renamed it to same name as the panel i used, hooked up the event handlers ect...
it wasnt flickering anymore but my drawings got all messed up... is that the only way to do it?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Isn't there a property to set the double-buffering. This no need for a custom panel?
By messed up how do you mean, that line shouldn't change anything unless your drawing code is badly written.
|
|
|
|
|
i got it working the previous way... all i did was do it over and it worked
Ed.Poore wrote: By messed up how do you mean
i use the panel.ClientArea as my square that i draw in, the same thing for every drawing method... yet half the pic was centered as it should be and the other half was way over to the left. maybe just a bug of some kind...
Ed.Poore wrote: drawing code is badly written
it probably is hey, im new to GDI and stil getting used to it...
thanx for all your help bud!
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Explain NullReferenceException? How to resolve it?
|
|
|
|
|
It's when you try to something with an object, but the object hasnt been created.
Look at MSDN for tons of examples.
|
|
|
|
|
Fix your code. If you don't know how, post it so we can explain it to you.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It occurs when you are accessing an object with NULL value. Make sure you instantiated object using new keyword.
cst_kvp wrote: Explain NullReferenceException
OT : why don't you be polite when asking questions ? Read this[^]
|
|
|
|
|
N a v a n e e t h wrote: why don't you be polite when asking questions ?
You're wasting your time. All his questions are
Subject: Life
Explain life?
The concept of actually showing what is being attempted to provide context is alien to him.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Kill the null!
|
|
|
|
|
I need to get the _Application (or _Document) interface from a running Word application. I know how to get this interface using ROT, but I need to do it in a deferent way.
In my case, I run in the context of the Word process (not as add-in). When I am inside the process I would like to get the running Word’s _Application interface so I can listen to events.
Thanks
Sagi
|
|
|
|
|
Hi! I want to populate a listview with items from the database, can someone help me how should I start...I really don't know how to populate...thx ahead
|
|
|
|