|
Can't you just get the cell from the row?
Grid2.CurrentCell = RegistoEncontrado.Cells["localidade"];
---
single minded; short sighted; long gone;
|
|
|
|
|
Sorry Guffa, i didn't saw your reply earlier.
No, the Row RegistoEncontrado doesn't have a Cells property, but thank you anyway.
Joaquim
-- modified at 10:18 Thursday 5th April, 2007
|
|
|
|
|
Hi all,
I use this code to fill the DataGridView but this code has error in the Underlined line
private void Form1_Load(object sender, EventArgs e)
{
DataSet1TableAdapters.ExpParamsTA ExpParamsTA= new Datam.DataSet1TableAdapters.ExpParamsTA();
ExpParamsTA.Fill(DataSet1.ExpParamsDataTable);
BindingSource Exp = new BindingSource(DataSet1, "ExpParams");
dataGridView1.DataSource = Exp;
}
Please help me
Thanks in advance
|
|
|
|
|
You only fill a dataset, it will populate the table. I will assume only one table is returned.
So something like:
ExpParamsTA.Fill(DataSet1);
DataGridView1.DataSource = DataSet1.Tables[0].DefaultView;
Hope that helps.
Ben
|
|
|
|
|
Maybe this can help.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Thanks in advance
![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
I'm pretty new to multithreaded code. I understand a lot of the concepts (or think I do), but I'm extremely green in applying them.
That being said, I have a webservice that is starting three threads. These threads could finish anywhere from a few minutes to a day depending on how much data is being processed from an external DB. The situation I'm currently experiencing is that if one thread fails, I'd like to stop the other two threads in order to save resources.
Initially I was using Thread.Abort(), but I quickly realized that when catching the ThreadAbortException and aborting the other threads, that would spawn additional exceptions, which would require a new try/catch block, etc. I started googling and saw more...impolite things said about Thread.Abort() and how it's hard to determine when the exception will even be thrown.
So, I'm trying to find a way to stop my threads without using Thread.Abort. I've seen people mention using a flag or Mutex to signal the threads to stop, but naturally that means all my methods need to check for this flag in many places, and I don't see a clean way to do that. Most examples I see will do something like:
(while !stopThread)
{
// do some work
}
which is very convenient of them. How is this relevant when the work is a one-time thing, not something you'd loop through? Is there something I'm missing?
Thanks for any and all help. 
|
|
|
|
|
Shawn H wrote: How is this relevant when the work is a one-time thing, not something you'd loop through? Is there something I'm missing?
Hmm, so there's no loop in your threads? Each thread just has a sequence of steps that is performed? Could you choose some strategic places within those steps to check to see if all is well?
if(everythingOk)
{
DoSomething();
}
if(everythingOk)
{
DoSomethingElse();
}
Kind of cumbersome, but it's the only way I can think of offhand for terminating a loopless thread "naturally."
|
|
|
|
|
Hi All,
This is a very simple situation. In VB 6 a label can be specified as transparent background. How to do this in C# Windows Forms.
Thanks
|
|
|
|
|
assign the BackColor of the label to Color.Transparent
|
|
|
|
|
Thanks for such instant reply.
I did this, -
this.lblFormHeading.BackColor = System.Drawing.Color.Transparent;
But still its not transparent.
|
|
|
|
|
What is your label sitting on?
You could grab the backcolor of that control and set your label's backcolor to the same value ...
|
|
|
|
|
Label is placed on a picture box. I didn't get you. Can you explain how to do that. Thanks.
|
|
|
|
|
Well now, I should have asked that question first ...
Go here[^] scroll to the bottom, there's a posting about creating a transparent label ... the syntax is in VB, but it's all .NET ...
|
|
|
|
|
Making a BackColor Transparent doesn't make your control transparent. It's a lousy name to use because people just assume that it makes the control, well, transparent. It does NOT do this!! Making your label transparent doesn't show you every behind the label.
What it does is make the label take on the background properties of the parent form it's hosted on. The label will show you the background as it is on the parent form, regardless of what controls are behind the label!
In your example, if you set the form's BackColor property to Red and put a Yellow PictureBox on the form, then add a Label control to the form, directly over the PictureBox, the label will show up as Red, not Yellow!
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
How does an application kill itself and restart itself? I have no idea how this is done. Do you fire off some messages to the OS, like "Close" and "Run"?
Marc
Thyme In The CountryInteracxPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Thought:
Creates a process to an external program, passing a handle to itself. That program, in turn, sits, waiting for that process to terminate, and then once terminated, attempts to restart it?
|
|
|
|
|
I am guessing you want to do something where you have an update to a windows application, so you need to stop the windows application and then restart it. I think the clickonce deployment for .net 2.0 does a pretty good job with some of these issues. If that is not an option then I think you might have to go with something like have a little exe that you distribute with your windows app. This little app would be called when the windows app closes itself to load the new exe. All the app would need to do is copy out the new code and the start the exe with something like Process.Start("exename");
Hope that helps.
Ben
|
|
|
|
|
hi guys,
i hav created an windows forms application using c# 2.0 using visual studio 2005.but the problem is when i click my controlbox in the top corner in the application it does hide the form but it doesnt exit the application...i can see the application running in the task manager?? is there any options to solve this issue..
I WANT MY APPLICATION TO EXIT ON CLICKING THE CONTROL BOX(X) IN THE FORM
aneef
|
|
|
|
|
Have you coded a Form Closing event handler? If so, what's in it?
|
|
|
|
|
well i didnt code FormClosing event..but now i tried that but still same?? why is that ?
here is the formclosing code i did now
private void frmMain_FormClosing(Object sender, FormClosingEventArgs e) {<br />
Application.ExitThread();<br />
Application.Exit();<br />
<br />
}
any solutions please
aneef
|
|
|
|
|
Well, the default behavior for that control box, is to close the form, so you must have code somewhere that's preventing this from happening.
What's in the Program.cs ? Do you have anything following the Application.Run() ?
You're best bet is going to be to step through your code in the debugger and find out where your form is being hidden and why your application is not terminating.
|
|
|
|
|
Is is possible to create a user interface control in C# .NET 2002 or 2003 that can be used by a Visual Studio 6.0 C++ dialog. I must substitute old J++ ActiveX user interface controls and rewrite then in C#. I have been doing research and have seen that it is possible to access .NET managed assemblies from unmanaged COM components, but these technical articles don't appear to address my problem. Is there some way I can convert a .NET control to an ActiveX component so that it will be accepted by the Visual Studio 6 C++ dialog builder? Any help, tips, assistance will be greatly appreaciated.
Steve J B
|
|
|
|
|
Hi,
I'm building a MDI application which will have a project enviorment.
I have never built such kind of complex application.
I have several datastructures which i need to store in order to keep a state.
I would like to ask how should i record all this into a file.
Thx,
Nuno
|
|
|
|
|
Well now, that's up to you. You could:
- Serialize the data to an Xml file(s)
- Store it in a database (e.g., SQLite, Firebird, MySQL, MSDE, etc...)
- Save it off in your own structured file
There is no 'one way' that is set in stone, and each has it's own pros/cons.
These are all design decisions that you need to make yourself.
|
|
|
|