Thank you for your replies. Simply i didnt like cellformatting so i wrote my own function. I used a foreach and got all rows from datagridview and coloured related cells. I know it is against performence but this thing doesnt require much performence. Thanks again.
leone
Posts
-
coloring a cell via datagridview cellformatting event -
Triggering a cellformatting event of a datagridviewHi. I have a cellformatting event of a datagridview. No problem when loading and running first time. But what should i do if i click on a button and run cellformatting with this click. I couldnt manage this. Even i run databindingcompleted manually but it didnt help run cellformatting.
-
coloring a cell via datagridview cellformatting eventHi. I try to color specific cells of a datagridview in cellformatting. everything is ok but if i color first row's cell, other rows' cells are coloured with the same color. so, for the time being i excluded to color first row. what should be the problem? this is the code:
if (e.ColumnIndex == 2) //my spesific column
{
if (dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString() !=bookmark_id.ToString()) //dont mind this line, business logic
{
//specialStates is an enum
if (dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() == ((int)specialStates.Anlasildi).ToString()) { dataGridView1.Rows[e.RowIndex].Cells["content"].Style.BackColor = Renk_Anlasildi_Backcolor; dataGridView1.Rows[e.RowIndex].Cells["content"].Style.ForeColor = Renk_Anlasildi_Forecolor; }
else if (dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() == ((int)specialStates.Onemli).ToString()) { dataGridView1.Rows[e.RowIndex].Cells["content"].Style.BackColor = Renk_Onemli_Backcolor; ; dataGridView1.Rows[e.RowIndex].Cells["content"].Style.ForeColor = Renk_Onemli_Forecolor; }
else if (dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() == ((int)specialStates.Soru).ToString()) { dataGridView1.Rows[e.RowIndex].Cells["content"].Style.BackColor = Renk_Soru_Backcolor; dataGridView1.Rows[e.RowIndex].Cells["content"].Style.ForeColor = Renk_Soru_Forecolor; }} }
-
Conditional query (sql)Hi friends. I have 2 coulmns in a table (RealPersonID and CompanyID). They are foreign keys. My problem is that either of them is always 0 and the other one is none zero. So i want to do that in only one query: x=(Select CompanyID from Table1) y=(Select RealPersonID from Table1) if x!=0 (select companyName from Companies where companyID=x) else (select personName from Person where personID=y)
-
html encode for datagridviewok. the problem is that i have some data in my db. But they are in html format. So what control do you advise to show them in winform applications.(data depends on sql query.)
-
html encode for datagridviewok. the problem is that i stored some strings in html format just because i intended to use them only sending via mails. But now i need to use them in winform datagridview. If there is no solution, i will code my own html parser.
-
html encode for datagridviewHtml tags are not being interpreted by datagridview. And tags appear in the datagridview.
-
html encode for datagridviewFor example this text is bold
-
html encode for datagridviewFor example this text is bold I want the text above to be seen as bold in my datagridview. Now it is seen as i typed.
-
html encode for datagridviewHi, i need a solution for my datagridview to recognise html codes. It is a winform datagridview, not an asp one.
-
GUI and database synchronizationThanks Eddy. I generally dont keep sql connection open. I open it once i need. so to do what you told me, i have to open an sql connection, read a table (modification dates table) and close it again. When i do so in every 20 seconds, i have a concern that the application will slow down. I notice that some programs that i use at work reflect changes immediately. I dont think that they check this modification table every 1 second. I am curious about this.
-
GUI and database synchronizationHello. I always wonder that how to keep users' GUI updated. I mean how a software should reflect its database fast and efficiently. I generally deal with this problem using a timer checking db every 20-30 seconds but i think it slows down my programs. I would prefer it like filesystemwatcher control. It realizes all files immmediately in folders and doesnt slow down applications at all.
-
How to get rid of interval checkingsHi friends. I have a database and people send some info into this db. But sending time is totally random. So now i check this db every 20 seconds and refresh my program according to new data. But as my user count increases, i need a more efficient approach. I mean how can my program know that somebody added something new into db.
-
Filesystemwatcher causes exception.Yes you are right. This is what i found in intellitrace: Exception:Thrown: "The process cannot access the file 'd:\deneme\OCTOPUSxml-66907571 - Copy.xml' because it is being used by another process." (System.IO.IOException) A System.IO.IOException was thrown: "The process cannot access the file 'd:\deneme\OCTOPUSxml-66907571 - Copy.xml' because it is being used by another process." Exception:Thrown: "Exception has been thrown by the target of an invocation." (System.Reflection.TargetInvocationException) A System.Reflection.TargetInvocationException was thrown: "Exception has been thrown by the target of an invocation." In created method of filewatcher, i have these codes: XmlDocument xdc = new XmlDocument(); xdc.Load(e.FullPath); Somehow, grasping the file by filewatcher and loading by xmldocument occur almost at the same time. To be sure i changed the code as : XmlDocument xdc = new XmlDocument(); System.Threading.Thread.Sleep(1000); xdc.Load(e.FullPath); System.Threading.Thread.Sleep(1000); I know this is not professional but now it is working :)
-
Filesystemwatcher causes exception.Hello friends. my question is very short. I only used one filesystemwather and nothing else. And used its created method. But when i send a file into the folder, it throws this error:"Exception has been thrown by the target of an invocation." on this line: Application.Run(new Form1()); Do you know why?
-
Sound transmissionOK friend. Thank you for your interest anyway. This article solved my problem: How to use the managed RTP API classes in .NET to create your multicasting systems[^]
-
Sound transmissionphone calls via their microphones. I couldn't find an exact solution yet but i am thinking of this: When a user clicks on a button to talk to someone else, i am planning to create a rtp stream. this stream wont go to anybody's computer. It will go to server itself but with some unique number on it. Somehow i will try to make users decode this stream using those unique numbers.
-
Sound transmissionHi friends. is it possible to use an asp web site like a telephone. i ve made a website. there are 10 users of this website. ı can understand who is online and who isnt. is it possible to put a button whose text is "talk to this user" next to each user and send and play this sound stream at remote side. I found this Sending and playing microphone audio over network[^] but it is quite complicated to me. Do you have an easier idea.
-
Need football game commentsYes i need sth like this but it seems something complicated. Do you have a simple code snippet?
-
Need football game commentsHi friends. I have made a small football season game program. But now i need some written comments like "excellent shoot from Xavi", "hit the crossbar" ... Has anybody worked on sth like this before? Or do you have any idea to share.