|
What do you mean by 'created' ? You can check if it's not null. Or do you mean if it contains anything ? You can check if it has any rows (Rows.Count, or Rows.Length, at a guess )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Khoramdin wrote: I was wonder if there is a way that I can programetically know if a DataTable has been created?
What do you mean?
Please do more spesific
Regards,
TomiEdy
|
|
|
|
|
|
Hello everyone,
I have a string which is consists of two sections/strings seperated by "_", ect. "StringOne_StringTwo".
Can someone tell me how I can seperate the two strings?
Thank you very much and have a great day,
Khoramdin
|
|
|
|
|
|
string[] theSplitStrings = theString.Split('_');
|
|
|
|
|
|
Hi
Not being cynical, but are you reading quetsions on CP, writing the answers on your own site, and then attempting to redirect the OP to it, in hope of generating revenue? Put your own site in your signature and put the actual answer in the thread. If your answers are good, you will get people visiting your site anyway.
Regards
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Haha.. not bad to have someone from the other side of the world having the same sense. You are as smart as you named. Thanks for the advice and I shall write my answer on both the thread and the website.
Btw, besides generating revenue, I am
1. Increasing my code collection
2. Polishing my programming skills
3. Pretending to be busy infront of my boss
Enjoy your day!
Eliz.K
|
|
|
|
|
Hello,
I have 30 thousand records. What would be the best and fastest way to populate the grid?
DataSource is the way to go I think.
Thank you.
-- modified at 16:40 Thursday 26th July, 2007
|
|
|
|
|
Yep, that would work.
|
|
|
|
|
Remember to use paging on your data grid.
Eliz.K
www.oin1.com
|
|
|
|
|
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.
|
|
|
|