|
30 thousand records in one single grid? Why do you want to do this? No user can scroll through 30 thousand of records!
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Dude, did you see the topic of this thread?
Did I ask your oppinion if I should populate 30 thousand records or not?
IF you have no suggestions, don't post.
|
|
|
|
|
Yeah i can read.
But you give very few information about what you really want to do. And my opinion is that is is very important to know what your application should do to provide a good solution (and you asked for the best).
So I could just say that you should go ahead and put all records into a DataTable and set it as the DataSource of the grid, call DataBind and wait for your browser rendering the page.
Or I could say, no better use an ObjectDataSource or SqlDataSource that provides the data to the grid, because this way you could implement paging, sorting much simpler.
But both ways are surely not the BEST ways to do it, but without knowing what you want to accomplish, I can not give you a better answer that the ones you already received.
So, sorry I tried to help - won't happen again.
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Say I have two DataTables in a dataset, Product and ProductType. Product has a column id that is a foreignkey in the ProductType table. I setup a datarelation between the two datatables, now how can I display all of the records from the Product datatable and the ProductType datatable in one datagridview? I've found lots of examples of setting up a master/slave relationship with two seperate datagridviews, but none with just using one.
Thanks,
David
|
|
|
|
|
Does anyone know a good C# to mono converter?
Thanks!
Sean Murphy
"All things great and small start at the same point, the first step."
|
|
|
|
|
Mono is a C# compiler not a separate language. If you're looking for a tool to change all the places your code uses something that the mono project hasn't gotten around to implementing, afaik there isn't one.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
You have a misunderstanding of Mono, my friend. Mono is a programming framework, like the .NET framework. You can use C# in Mono just like you can in .NET. You don't need to convert C# to anything to run it on Mono. If your C# code uses some library, say a native Win32 library, then you'll need to change it to use something more cross-platform.
AFAIK, there is no converter that automatically makes your project run on Mono. If you used purely the .NET framework, chances are it will compile OK on Mono. You can use the Moma[^] tool to see if you need to make any changes to your code for it to work on Mono.
|
|
|
|
|
Judah Himango wrote: ou can use the Moma[^] tool to see if you need to make any changes to your code for it to work on Mono.
Thanks
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Hey all,
I've been puzzling this over for the last hour; basically I only want to wait a certain amount of time for a method to complete before giving up (or unless a certain condition is met).
I've tried a few things involving watcher threads and so on, and finally hit upon the idea of using an asynchronous delegate (after some nosing around MSDN):
delegate string Worker(string args);
public string DoWork(string args)
{
Worker d = new Worker(Workhandler);
IAsyncResult result = d.BeginInvoke(args, null, null);
if (!result.IsCompleted)
{
result.AsyncWaitHandle.WaitOne(1000, false);
if (!result.IsCompleted)
{
return "Timeout!!";
}
}
return d.EndInvoke(result);
}
private string Workhandler(string args)
{
Thread.Sleep(2500);
return args;
}
Now the above seems to work perfectly ok, but I'm the first to admit I don't know much about delegates. So my questions are:
1.) If a timeout occurs (as in the above faked up example) what happens to the Workhandler? Does this continue to run, or does the .Net Framework leap in and forcibly stop any processing?
2.) I imagine that
d.BeginInvoke is starting a thread; is this so, and where does this thread exist in terms of the application? Is it possible to grab hold of that thread without using the delegate to control it?
3.) Am I giving myself enough rope to hang myself with here - could this go horribly, horribly wrong in subtle ways?
4.) Are there any better/more standardized/preferred ways to achieve what I'm trying to achieve?
-- modified at 14:58 Thursday 26th July, 2007
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
martin_hughes wrote: 4.) Are there any better/more standardized/preferred ways to achieve what I'm trying to achieve?
I am unsure if you have considered this, but I believe that this could possible work, not sure if it is preferable. Use a System.Timer and start it at the beginning of your method. create an event that watches the timer, and fires at every tick. when the ticks get to the time you specify, you could kill the method.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
It's a good thought, and I think I tried something similar - the problem I had here (my apologies, I wasn't very clear in the original post as to why the method may take so long to complete) was that the method couldn't easily be interrupted.
Basically the method called a synchronous funtion in an external library which fires a barcode scanner. Every so often the call just seems to hang - either a fault in the library or the hardware itself is my best bet - causing my application to hang and the device needed to be reset causing much anger and frustration with my users.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
Use a mix of Thread and Thread.Join. Here is an example:
public void MyWorkerThread()
{
try
{
}
catch (ThreadAbortException)
{
}
}
public void MyWaitingMethod()
{
Thread t = new Thread(newThreadStart(MyWorkerThread));
t.Start();
bool threadFinished = t.Join(30000);
if (!threadFinished)
{
t.Abort();
}
}
Something along the line.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Hello,
I would like to know what happens to a class when I declare it inside a loop. Is it eliminated by the GC when the cycle ends, before a new instance of the same is created?
An example:
namespace Whatever
{
class Model
{
my fields and methods
}
class Program
{
static void Main
{
Var declaration
...
while (condition)
{
Model temp = new Model();
...
...
}
}
}
}
Am I doing it correctly?
Thanks in advance for the attention.
|
|
|
|
|
It is not garbage collected immediately, but it is flagged for garbage collection. When the next garbage collection occurs, it may (or may not!) be disposed (and then queued for some other things like finalization), depends on the GC to decide when/what to do with it. Classes that use a lot of resources should implement the Dispose design pattern so that they can be explicitly disposed of in the code, releasing expensive resources such as images, file handles, database recordsets, etc... instead of relying on the GC to eventually get to them. If you are allocating expensive resources in a tight loop, it is imperitive that you dispose the objects when you are done using them, or memory usage will explode.
|
|
|
|
|
Thanks!
|
|
|
|
|
PhilDanger wrote: t is imperitive that you dispose the objects when you are done using them, or memory usage will explode.
That is true, and I was thinking along the lines of performance hit, as well.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Going a bit deeper, if I have
namespace Whatever
{
class Base
{
...
}
class Model
{
List<Base> myList = new List<Base>();
my fields and methods
}
class Program
{
static void Main
{
Var declaration
...
while (condition)
{
Model temp = new Model();
...
...
}
}
}
}
Do I have to implement in the Base class the :Idisposable interface?
I've tried to implement it on Model class, and I have an error at execution, that has something to do with infinite loops, when the Model.Dispose() method is called.
Thanks for your quick answer, previously.
|
|
|
|
|
No. A List is a managed object, so you don't need to implement IDisposable to take care of that. You only need IDisposable to handle unmanaged resources.
When the reference to the object is not used any more, the object, the List inside the object, and every object in the List are all collectable (unless the object are referenced elsewhere, of course).
The garbage collector doesn't look for object to collect, it looks for the objects to keep. That means that at the instant that an object gets collectable, all objects that it contains are also collectable.
---
single minded; short sighted; long gone;
|
|
|
|
|
Let's say you have a List<Bitmap> (or something else that is disposable). You will want to give your Base class a Dispose() method so that you can loop through the List and Dispose of everything manually.
Basically, if your class contains unmanaged resources OR contains members that implement IDisposable, you'll want your class to implement it as well.
--sorry, meant this as a reply to OP.
|
|
|
|
|
I am trying to bind a DataGridView to a Collection that implaments IList<t>. The Entities in the collection contain properties that will be displayed as columns in the DataGridView. This all works fine.
One of the properties in the Entity is itself another Entity. I want the DataGridView to bind to a property of the nested Entity. How would I acomplish this?
Example Description:
I want to bind a DataGridView to the EmployeeCollection. The columns I want to display are EmpNumber, EmpName.LastName, EmpName.FirstName. I have tried setting the DataPropertyName on a column in the DataGridView to EmpName.FirstName and this does not work. I would like to solve this issue without exposing the properties to the Name Class in the Employee Class.
Example:
public class EmployeeCollection : List<employee>{
}
public class Employee{
public string EmpNumber { get; set; }
public Name EmpName{ get; set; }
}
public class Name{
public string FirstName { get; set; }
public string LastName { get; set; }
}
Thanks for your help.
Patrick McCoy
|
|
|
|
|
Hi guys,
I'm using an object data source in a windows app with a datagridview. The grid binds fine, and populates all text fields ok. Now i want to be able to populate the DGV with existing data as well. The whole thing binds as usual, but the "Selected" field is now occasionaly true.
Now - regardless of what i do, it refuses to set the check boxes to true. I have attempted to set the TrueValue and FalseValue to their relevant boolean strings, as well as bit values.
Changing the value through the GUI assigns the value as expected.
This is perplexing me, any pointers.
Cheers
Tris
Update: The values are being re-set when i display the dialog as a SelectionChange event is being thrown. When i origionaly bind the data i have a _isLoading flag to early exit before any process.
Is there any way to suspend this event?
-- modified at 12:37 Thursday 26th July, 2007
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
|
Hi Eliz,
Thanks for the reply but i was using WinForms. I've fixed it now; Had to move the initialization to the OnFormLoad event, this handled things properly on the ShowDialog() call.
Cheers
T
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Hi,
I am essentially trying to rename the columns of a table I retrieved from a database using an OracleConnection in C#.
I have tried TableMappings.Add -->> ColumnMappings.Add but I when I try to build, I get a "Child list for field server_EOD_Execution cannot be created" exception.
I'm sorry but I'm at my wits end with this one. Can someone please help
Is there another way to implement the renaming?
God speed
Deji
|
|
|
|
|
You could have a look at this link[^] on msdn, it shows you how to rename a column and the issue related to renaming it and the workaround to fix it.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|