|
i spoke about a windows application not web application my friend
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Is the column a bound column, or an unbound column.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
no that is not a bound coloumn
the column is used for showing to user the step of action such as start(show start symbol) or pause(show pause symbol) or stop(show stop symbol)..
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Then handle the CellClick event of the DataGridView :
private Bitmap start = new Bitmap("LocationForImage");
private Bitmap stop = new Bitmap("LocationForImage");
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewImageCell img = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewImageCell
if (img != null)
{
if ((bool)img.Tag)
{
img.Value = stop;
img.Tag = false;
}
else
{
img.Value = start;
img.Tag = true;
}
}
}
This assumes that there is only one Image column.
As you initially load the data into the image cells, you must set the Tag property to either true (start image used) or false (stop image used)
I hope that this helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thank you my friend for your reply
your code run correctly but without any result and the image has not changed.!!!!
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Well I hadn't tested it although there was no reason that it shouldn't work, so I built a test app and it works exactly as I thought.
Here is the code for the entire form:
public partial class ImageColumnTestForm : Form
{
private Bitmap start = ImageCellTest.Properties.Resources.START;
private Bitmap stop = ImageCellTest.Properties.Resources.STOP;
public ImageColumnTestForm()
{
InitializeComponent();
}
private void ImageColumnTestForm_Load(object sender, EventArgs e)
{
DataGridViewRow newRow = null;
DataGridViewTextBoxCell textCell = null;
DataGridViewImageCell imgCell = null;
for (int i = 0; i < 5; i++)
{
newRow = new DataGridViewRow();
textCell = new DataGridViewTextBoxCell();
newRow.Cells.Add(textCell);
imgCell = new DataGridViewImageCell();
newRow.Cells.Add(imgCell);
textCell.Value = "Text " + i.ToString();
imgCell.Value = start;
imgCell.Tag = true;
this.dataGridView1.Rows.Add(newRow);
}
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewImageCell img = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewImageCell;
if (img != null)
{
if ((bool)img.Tag)
{
img.Value = stop;
img.Tag = false;
}
else
{
img.Value = start;
img.Tag = true;
}
}
}
}
As you can see I simply copied the CellClick code from my previous reply to you and all that I changed was to add the semi-colon to the first line, as I am sure that you did.
This is just a standard form with a datagridview on it and it works just fine.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thank you man
you see i try your code again in new project and work correctly then try to affect your code in main project but not work at all so i decide to create my datagridview and finally work correctly.
i think that the problem was on visual studio not on your code or previose code that i used.
thank you again.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Hi there,
I've developed a set of custom classes to aid in the printing process. Not reports, or anything databound or table related, just some classes to create and save layouts of printing documents.
What I'm wondering now, is how would I move from some classes, which can only be used in code, to a complete package that employs a designer to do the layout at design time in a designer, almost like the winforms or reports designers I've seen.
At this stage all I have is classes, I'm looking for tips on putting these classes into a package with designer functionality that is incorporated into Visual Studio.
Just some advice on direction or where to find further information would be GREATLY appreciated!
Thanks!
|
|
|
|
|
RobertFall wrote: Just some advice on direction or where to find further information would be GREATLY appreciated!
I think this MSDN site[^] may be what you are looking for.
|
|
|
|
|
I did have a look there, and I am currently labouriously pouring through the topics, was just wondering if someone had done this before and knew which specific articles to read or even of a tutorial that might help?
Thanks Again!
|
|
|
|
|
I just found this[^] here on CP; any good?
|
|
|
|
|
It looks promising! Thanks a lot!
|
|
|
|
|
Hi everybody, I have DataSet which is filled by a database table called "schedule". And I want to compare the values of specific columns that are found in different rows, is possible? If it is, how? Thank you.
|
|
|
|
|
The rows are indexed entries, so you can refer to them by their position. Suppose, for instance, that you want to compare items in the current row and the next row, the following code will do:
DataTable tbl = myDataSet[0];
for (int i = 0; i < tbl.Rows.Count - 1; i++)
{
if (tbl.Rows[i]["myColumn"] == tbl.Rows[i+1]["myColumn"])
{
}
}
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Apart from what has been replied, you can also use the DataTable.Select method. You can specify the column value there and all the rows having that value will be returned. Depends on the scenario, which approach you should go for.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi,
i want to ask whether there are any events for windows forms which will help me detect if the form is fully loaded. i.e that the UI is completed loaded and is visibly to the user, so that i can perform some actions after that.
I intend to display some animations only when the user interface is completely loaded and visibly to the user. Using the form_load events does not help as already everything will be loaded when the form appears. i wish to do some action after some time.
Anything except timers.
|
|
|
|
|
There is a visible changed event, I think, but the loaded event has always worked for me.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
na!!! u mis understood me.
I just want to do something once the UI is fully loaded and is displayed.
I will try the visible changed event. but still there should be some kind of indication which could tell me if the user interface load is complete and it is displayed fully onscreen
|
|
|
|
|
Hi,
Take a look at the Application.Idle event which is raised whenever the windows message queue is empty. The first time this happens is when the the form is fully displayed. Detach the handler within the handler if no more notifications are needed. Hope that makes sense!
private void Application_Idle(object sender, EventArgs e) {
Application.Idle -= new EventHandler(this.Application_Idle);
}
Alan.
|
|
|
|
|
Alan N wrote: whenever the windows message queue is empty
Does this state always get hit when the form has completed, can the user start filling the queue by banging on a button or activating another event before this state can be reached.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Good point, I was assuming a hypothetical well behaved and patient user, which is probably unrealistic.
Alan.
|
|
|
|
|
It cannot be relied upon to do what you want. Idle only fires when the message queue for the entire application is empty, not when any one form is idle.
The VisibleChanged event of the form is about as close as your going to get. Just be sure to check the Visible property of the form so you're not trying to do whatever you need to when the form is no longer visible or gets covered up. You're also going to have to make sure you set a flag to know that you've started whatever work you need. The VisibleChanged event will also fire if anotehr form obscures your form and when the form is no longer obscured.
|
|
|
|
|
Hi,
Have a look at the Form.Shown event.
Is it too hard to look over the list of available events? do you really want to wait one hour or so for an answer?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
:P
No dude its not hard, but experimenting with these events takes time and i don't have much for one thing. So y not ask the people who have already experimented on it.
|
|
|
|
|
hi all,
$("div.newdiv").bind("click", newdivclick);
i know this will bind the click event of all div having cssclass 'newdiv' to the function 'newdivclick'.
My doubt is can i do a similar thing with .live method?
$("div.newdiv").live("click", newdivclick);
this din work for me.
i want to bind all divs with a specific class to a function on click or any other event. and i will be creating dynamic divs too which should also be binded to that function. thats y looking for live method.How can i do it. can anyone help me.
|
|
|
|