|
hello
i have a form in c#.net windows application.
in this form a dataset and a table adapter is used.so is a grid.
this form shows a grid that contains the records that are retrieved from a table in my database
how can I change the color of a row in a grid ???????
plz help me
|
|
|
|
|
Try the following code
dgView.Rows[1].DefaultCellStyle.BackColor = Color.Yellow;<br />
dgView.Rows[1].DefaultCellStyle.ForeColor = Color.Black;
Regards,
|
|
|
|
|
|
|
Now if I can only figure out why, and see if there is a method of controlling it.
I bet it has something to do with the byte[] array, since there is always 4 numbers. Either that or its the buffer that comes from said length. If its possible to record either one, and then store that instead in memory then I think I might have a workeable solution.
|
|
|
|
|
Jeremy - please don't start new threads off that detail solutions to recent threads. You've posted multiple times today, so it would seem reasonable that you continue these ideas on the old threads. You may know what this all relates to, but the casual browser doesn't.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi, if anyone could point me in the right direction on how to obtain the actual text from within an editor control of an external application. I'm currently looping through the classes until i find the VSTextEditPane handle, but what now.. How do I read the text. Is there some kind of text buffer one uses and how do i accomplish this? The objective is to read queries from within SQL management studio. Your expertise and suggestions would be appreciated.
Thank you Guru SIR
Izak
|
|
|
|
|
Hi,
you will need a couple of P/Invoke operations to call some Win32 functions.
First you need to somehow find the right Window, maybe based on its title;
then ask for the text it contains (give the StringBuilder sufficient initial capacity!).
The following may help you:
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern int EnumWindows(LP_EnumWindowsProc ewp, object lParam);
public delegate bool LP_EnumWindowsProc(IntPtr hWnd, int lParam);
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern int EnumChildWindows(IntPtr hParent,LP_EnumWindowsProc ewp, int lParam);
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern void GetWindowText(IntPtr hWnd, StringBuilder sb, int capacity);
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern int GetLastError();
Good luck!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thx buddy,
I've done all of that already.. The problem lies within me not knowing how to obtain the text or the actual queries that resides withink SQL mng Studio.. I've obtained the handle of the app, then enum through the lot until I struct the VsTextEditPane that is used by Mgnmt studio.. Now what??
There must be some kind of way to use p-invoke to then extract either all text via a sendmessage or the line at which the carret is focussed?? dunno.. A low-level keyboard hook is not my ideal as i'm interrested in the text.. at any point i want to read queries..
Thanks mate
|
|
|
|
|
Hi,
I don't know about database stuff; getting text from a window is what GetWindowText does.
Hope that helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I am trying to create a win app that will get UK lottery results from the web and store them in the application. Via regular checking the application will than always be up to date with the results.
What would be the best approach to achieving this?
My first thoughts were to access a rss feed, but ive had no success.
Any ideas welcome.
|
|
|
|
|
You could always read the page and parse it. There is an SGML parser on Code Project I used a while back.
The problem with this approach is that the web page is designed to be human readable so the structure of the HTML may change at the whim of some marketing department somewhere.
|
|
|
|
|
hi.
every time i build the solution, a command prompt window appears (black window). How do i go about not making the window appear. I only want the form to show not the black window too ???
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Oh sorry... i found it
when i added a project i said empty project and not window application. Thank you anyway
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Hi, is there a problem when i use an object instance like this ?
( new AnyClass() ).SomeMethode(); instead of
AnyClass ac = new AnyClass();
ac.SomeMethode();
The compile dont have a problem with it but i asking me whether it is good or bad
|
|
|
|
|
Hello,
No problem, but:
I wouldn't want to see code like this in one of my projects.
If it makes sence to do this:
MarkPhB wrote: ( new AnyClass() ).SomeMethode();
,there is not need to use a class at all, I guess.
You could simply use a static method.
All the best,
Martin
|
|
|
|
|
Thanks for the answer =)
i use this sometimes when i have a class with have a methode that i need only one time. Like
( new Form1() ).ShowDialog() or
( new RNGCryptoServiceProvider() ).GetBytes( randomBytes );
|
|
|
|
|
Hi,
I don't like your ( new Form1() ).ShowDialog(); since Form1 (assuming
inheriting from Form) offers a Dispose() method which you should call once you don't
need the Form1 instance any longer.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Very Good point Luc!
I would use a "using" block for that!
All the best,
Martin
|
|
|
|
|
I'm learning about IE Addon. I would like to know how to create the build-in object for IE. For example, "document" is the build-in object of IE and we can write the code like "document.getElementById() or document.write()" in Javascript. I wanna add "mydocument" object to Javascript engine of IE so that I can use the code like "mydocument.write()" in Javascript. I don't know how to do it and I googled about that but I didn't get any link for reference.. It would be great if anyone tell me how to do it or give me a link for reference..
Thanks in advance. Any idea would be appreciated.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi Michael,
Assuming you use the javascript engine from 'mshtml' interop.
MSScriptControl.ScriptControlClass.AddObject(string Name, object Object, bool AddMembers);
should do the work.
e.g.:
ScriptingEngine.AddObject("window", webBrowser.Document.Window.DomWindow, true);
ScriptingEngine.AddObject("document", webBrowser.Document.DomDocument, true);
Hope It helps
|
|
|
|
|
Thanks. Girm. I will try as you mention.. Thanks again.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I've got to ask this. Why are you fishing for votes?
There are any number of people on the site now who are asking for votes so that they can become MVPs. Is this why you frequent the boards or is it to do something for others?
When I answer a question, I'm doing it to help others and give something back to CodeProject - if people vote, fine, if not, well that's fine as well. The only thing I would expect is that if I give a right answer, that the OP replies to let everybody else know that the answer was correct. In this way, other people who have the same issue can identify what worked without having to muck around trying things that didn't work. That's all that anybody can ask.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Okay. Pete. We already discussed about that once in this forum. In order to reply you the completed one, I was finding a lot of messages to get the one that we discussed..
#1. Why are you fishing for votes? Is this why you frequent the boards or is it to do something for others?
No and Yes.
Why "No"? I love to help other people. I used to participate in CodeProject and DevX forum whenever I have some free time.. ( here [^] is my profile in devx forum.) There is no MVP program in DevX forum.
So, I'm not coming here to become just a MVP.
Why "Yes"? I believe that it is good to become a MVP.. So, I don't mind if I become a MVP too..
#2. As I suggested here[^], the vote will help people to find the useful question and answer..
I wrote:
#2. Searching post by scores
I think that there are a lot of valuable posts in our forum. I wanna read those posts when I have free time. So, it is better if we can find those posts in easy way..
#3. Searching unanswered post by scores
At the same time, it would be great if we get the list unanswered posted based on scores (demand). We should encourage people to vote the question if it is good and useful.
#3. We already discussed about that earlier. (Please check this link[^] )
So, I want people to vote the message.. sometimes, people don't know to vote the message so I wrote about it in my signature to encourage people to vote the message.. I think that there are some people who feel the same way like me .. if you think that it is not necessary to write like that in your signature, it is okay. don't write this..
Thanks for asking.. because you give me a chance to explain why I'm coming here.
Let me know if you have any comment or suggestion..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Michael Sync wrote: Why "No"? I love to help other people. I used to participate in CodeProject and DevX forum whenever I have some free time..
Good answer.
Michael Sync wrote: #2. As I suggested here[^], the vote will help people to find the useful question and answer..
Like it.
You could summarise this and include it in your sig rather than having something that looks like soliciting in.
Deja View - the feeling that you've seen this post before.
|
|
|
|