|
Hi ,
I want to give the color to the particular row of the datagrid at runtime....when....the template column is clicked....so i want to give the backcolor to the entire row at that time that means runtime....
In datagird I have a one column which is a template column...
i have tried like this but this is giving color to the row permanently.....& want to change its color as & when that row's template column clicked....please help me
for(int i=0; i < DGPODetailShow.Columns.Count;i++)
{
DGPODetailShow.Items[0].Cells.[i].BackColor=System.Drawing.ColorTranslator.FromHtml("#EBE5DE");
}
Can anybody help me....
Thanks
|
|
|
|
|
This question belongs in the ASP.NET forum. I'll give you a hint, though: read about ViewState .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
im new to this forum.
i have one issue, i want to do the programming in MSN6 messenger in C#.
do anybody has the idea from where i can get the library, functions for researching for the MSN6 messenger.
its urgent, please help me out.
thanx a lot in advance
Naveen
|
|
|
|
|
Hi !
Search on the codeproject site (with the "msn" keyword), they're some articles.
And on the msdn site
Bye
|
|
|
|
|
Hi all,
im new to this forum.
i have one issue, i want to do the programming in MSN6 messenger in C#.
do anybody has the idea from where i can get the library, functions for researching for the MSN6 messenger.
its urgent, please help me out.
thanx a lot in advance
Naveen
|
|
|
|
|
Well, I just googled for it and discovered I need not have gone so far. The top item in Google's search was right back here at Code Project.
http://www.codeproject.com/com/msn_messenger.asp[^]
Although this example is in in C++, I don't think it would take much to translate it to C#
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
You have to love how cyclical life can be sometimes....
Jeremy Kimball
I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
|
|
|
|
|
...and how Google can find many solutions in most cases; now if only the majority of others would realize that.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well, you could also try going to the References folder of your project and Add Reference to the COM library "Messenger API Type Library". You'll have to declare an object of type MessengerAPI.Messenger or something close to that. I don't exactly know what it would be because I don't use MSN or have Messenger installed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello!
I wonder if there is a way to access the properties of the controls of another application's forms at runtime...
For example, i want my application to monitor wether a checkbox on another application's form has or has not been checked.
A non-.NET solution would also be useful.
If anyone has ideas, please reply!
10x!
|
|
|
|
|
You're likely looking at using Win32 API P/Invoked calls to FindWindow and GetWindowLong . How comfortable are you with the old APIs?
Jeremy Kimball
I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
|
|
|
|
|
There is no easy way of doing this and no support it in the .NET BCL. Like Jeremy said, "How comfortable are you with the Win32 API?" You'll need to have an in depth knowledge of how windows and controls work and how to pass messages to these windows to get information back from them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have made some 'research' based on Jeremy's suggestions and, indeed, there is no easy way to do that since I'm not very familiar with the Win32 API. I guess i'll wait for future managed implementations..
Thanks anyway!
|
|
|
|
|
Not likely going to happen. What you want to do is difficult because most of the time you have to write custom code to even find the window your looking for, then not all windows are going to expose their properties the same way. Some you can get through send message back and forth, others you have to cast a point to the Win32 Class (not the .NET Framework class!) to get at the properties.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
My problem: i have this table, with about 10 to 20 thousand records; applying a rowfilter on a dataview for this table works kind of nice; the thing is that when I have no records matching the given criteria, applying the filter takes way too long (and speed for my program is quite important). I also tried "cheating" (find/rowstatefilter = none), but it seems applying the rowStateFilter lasts about as long as applying the filter. Does anyone have any ideas?
Thx
|
|
|
|
|
Filter it on the database server - that is what it is good at.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
create some index in your software with keyedlist or some array, it demand more memory, but increase speed.
|
|
|
|
|
I agree with Colin, write your SQL so it does the filtering depending on a parameter passed into the stored procedure. There is no reason for you to be passing tens of thousands of records to a client that will only display 10-20 records on the screen at any one time. You might also want to include paging support in the SQL and the Datagrid.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi ,
I want to paint or we can say give the color to the particular row of the datagrid....when....the template column is clicked....so i want to give the backcolor to the entire row at that time....
In datagird I have a one column which is a template column...
Can anybody help me....
Thanks
|
|
|
|
|
The fact that you're mentioning a template column tells me that you're using an ASP.NET DataGrid . If so, this belongs in the ASP.NET forum.
In Windows Forms, you cannot paint an entire row; you can only paint columns by using a custom DataGridColumnStyle implementation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i have a c# app that i am writeing to read a visual foxpro 8 database but when i read the database with c# i lock the table and no one else can use it how to i make it use the file for shared access
thanks
chad aiena
|
|
|
|
|
How are you using it? Are you using ADO.NET to "read" the FoxPro database? There are connection string settings you can use to open the database as a shared database, and last I knew this was the default. Read the FoxPro documentation for more details about the connection string. Anything it documents for its OLE DB provider you can use in the OleDbConnection , and anything for the ODBC driver you can use in the OdbcConnection .
If you're simply reading the file as a stream (and why would you do that? just use the OLE DB provider), then you must specify the appropriate FileShare enumeration member:
FileStream file = new FileStream("file.dbf", FileMode.Open,
FileAccess.Read, FileShare.Read); This allows others to read but not write the file. Read the class documentation for the FileStream in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Please forgive me for being a complete amaeteur about this stuff. I really dont know what I'm doing. The problem I am having is with my scrollable control I am making. Here is the code below for the onPaint.
protected override void OnPaint(PaintEventArgs e)
{
// TODO: Add UserControl1.OnPaint implementation
base.OnPaint (e);
System.Drawing.Graphics g = e.Graphics;
//Draw the underlying background, including alternating row colors.
#region Draw the row backgrounds
//Brushes for the row backgrounds
System.Drawing.SolidBrush backcolor = new SolidBrush( this.RowBackgroundColor );
System.Drawing.SolidBrush altbackcolor = new SolidBrush( this.RowAlternatingBackgroundColor );
//Now draw the rows backgrounds.
float startpos = 0;
bool alternate = true;
int controlwidth = this.ClientRectangle.Width;
while ( startpos < this.ClientRectangle.Height )
{
if( alternate == true )
{
g.FillRectangle( backcolor, 0, startpos, controlwidth, this.RowHeight );
alternate = false;
}
else
{
g.FillRectangle( altbackcolor, 0, startpos, controlwidth, this.RowHeight );
alternate = true;
}
startpos += this.RowHeight;
}
backcolor.Dispose();
altbackcolor.Dispose();
#endregion
}
My problem is this. I put this control on a blank form and then put a listbox inside this control and made the listbox longer than the control so scoll bars would appear. When I run the form everything appears normal at first. However, once I scroll, the background, that should be just alternating colors does not get updated. One color will just take up the rest of the space on the bottom of the control. I hope that makes sense, it's kind of hard to explain. Any help would be appreciated. Thanks
Paul Rogero
|
|
|
|
|
Either create a bitmap (you can save it as a BMP (large), JPEG (small), or PNG (medium, but nice), or other formats but I recommend those. Then assign that to the BackgroundImage property.
Or, make sure you update your code according to the scroll position. When you paint, you can only paint in the client area (i.e., the visible portion of the code). Scrolling the control will not automatically do this for you. You have to code your painting handler to take the correct scroll position into account. Use the AutoScrollPosition (defined by ScrollableControl , inheritted by any derivative like UserControl and Panel ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Paul,
Below is your OnPaint function. I changed it to fix your problem (or what I believe you are saying is your problem) The fix was only two lines and they have //********** at the end of them so they stand out.
<br />
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
base.OnPaint (e); <br />
<br />
System.Drawing.Graphics g = e.Graphics;<br />
<br />
#region Draw the row backgrounds<br />
System.Drawing.SolidBrush backcolor = new SolidBrush( this.RowBackgroundColor );<br />
System.Drawing.SolidBrush altbackcolor = new SolidBrush( this.RowAlternatingBackgroundColor );<br />
float startpos = AutoScrollPosition.Y;
bool alternate = true;<br />
int controlwidth = this.ClientRectangle.Width;<br />
while ( startpos < this.ClientRectangle.Height - AutoScrollPosition.Y )
{<br />
if( alternate == true )<br />
{<br />
g.FillRectangle( backcolor, 0, startpos, controlwidth, this.RowHeight );<br />
alternate = false;<br />
}<br />
else<br />
{<br />
g.FillRectangle( altbackcolor, 0, startpos, controlwidth, this.RowHeight );<br />
alternate = true;<br />
}<br />
startpos += this.RowHeight;<br />
}<br />
backcolor.Dispose();<br />
altbackcolor.Dispose();<br />
#endregion<br />
}<br />
Hope this helps!!
Karl Baum
CEO of KGB Technologies
Specializing in custom software development.
|
|
|
|