|
You have to use BeginInvoke method of the control while modifying the controls' property from a different thread other than which the control was created on.
refer the link
http://msdn.microsoft.com/en-us/library/a06c0dc2.aspx
hope it solves ur problem
|
|
|
|
|
I'm trying to write a Custom Panel that draws contained controls with mixed art stuffs (rectangles, circles, triangles). I've done it very well, the problem comes when I implement double buffering. Here's my code
class BgPanel : System.Windows.Forms.Panel
{
//....
private Image buffer;
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawImage(buffer, 0, i);
}
private void RenderToBuffer()
{
Graphics g = Graphics.FromImage(buffer);
foreach(Control c in Controls){
DrawArts(g); // draw some colored shapes
//********************
How do I draw each control into buffer?
//********************
DrawArts(g);
}
}
//....
}
My problem is that I don't know how to draw each control inside the panel into buffer image. Could anyone please help me with this?
I'm working on .NET CF 3.0, by the way.
Thanks,
iSoft of Technomation
modified on Sunday, December 7, 2008 6:13 PM
|
|
|
|
|
|
I work for a police department and we just got new equipment in our cars. We are still running xp and have new keyboard (staco m901). On the keyboard it has an emergency button that is supposed to be programmable to do whatever we need it to in an emergency. From what I have read you have to do that through a macro. That's all I really know about it. There was no manual with it and the company won't reply to e-mails. What I'm wanting to do is make it so when you push the emergency button it black out the screen. I don't really care how it blacks out the screen whether it is diabling a driver or popping up a window I just need it to black out. Then when they are ready I need to be able to push a button (doesn't matter which one) to get the screen to reappear. I have never used a macro in windows (if that is what I'm needing to use) and can't really find any help on how to do it.
Thanks for any help,
Alex Wiltz
Communication Specialist
Kansas State University Police Department
|
|
|
|
|
"Macros" are a concept in software, not a keyboard. All the keyboard does is send a small code that says which key was pressed. It's up to your software to know what to do with that keypress, if anything.
So, if the software you're running (I'm assuming here!) on Windows XP exposes some kind of macro functionality, what you do depends on the environment exposed by that software to the macro code.
Now, if the software doesn't expose anything, then you'll have to write your own application that starts a global keyboard hook, looks for that one key, and either creates a window that covers the entire screen, or locks the Windows XP workstation. In the case of covering the screen with a blank window, you'll also have to have the hook code listen for another keypress and destroy that window when needed.
|
|
|
|
|
why this code threw exception?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=c:\Degree.mdb")
Dim cmd As New OleDbCommand("select * from Student", con)
con.Open()
Dim sdr As OleDbDataReader = cmd.ExecuteReader()
Do While (sdr.Read = True)
Me.DataGridView1.Rows(0).Cells(0).Value = sdr(0)
Loop
sdr.Close()
con.Close()
con = Nothing
End Sub
the exception details
System.ArgumentOutOfRangeException was unhandled
Message="Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"
ParamName="index"
Source="mscorlib"
|
|
|
|
|
Without more information it's hard to tell, but I suspect that the table Student has records containing more than one value - ie StudentID, StudentLastName, StudentFirstName, etc. You are trying to shove all values of a record into a single cell of the DataGridView. Also, since you are using a loop to step through all the values in the DataReader, I assume you expect more than one student to be returned. Why, then, are you not providing an index to step through the rows and cells of the DataGridView? Instead, you are repeatedly assigning each record to the same row and cell.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
You execute the reader and then you set a value into the datagrid. In what point the datagrid will have rows or cells?
The 'correct' way to do this is that you fill the datagrid using databinding, otherwise you have to create the columns and the rows to the datagrid manually. You can't just assign a value to a datagrid cell and expect that the framework creates a cell if it's not present.
|
|
|
|
|
I need to fill Autocomplete textBox dynamically. any one have idea for that?
|
|
|
|
|
Do use the search textbox at the top of this forum (I did a search on autocomplete textbox and found about 33 potential candidate articles). If I recall, there are a few articles floating around here on the subject. Good luck
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
Jeez, gave him a good answer, no thanks and reposts. Some people, I swear
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Paul Conrad wrote: gave him a good answer
Agree (and 5'd)
Paul Conrad wrote: no thanks and reposts
Yeah, I know what you mean.
Gladly many people understand that the conversation goes both ways and this site is not somekind of paid support (it isn't... is it? Did my post office misplace the paycheck... Again ).
|
|
|
|
|
Mika Wendelius wrote: this site is not somekind of paid support
Yep.
Mika Wendelius wrote: Did my post office misplace the paycheck...
Go give your local postmaster hell, then
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
yeah.. searched ...but no clues around Dynamic filling..
modified on Tuesday, December 9, 2008 11:46 PM
|
|
|
|
|
SelvaSR wrote: but nothing is thr for multicolumn autocomplete textbox
possibly not, but then your original post never mentioned multicolumn did it, so why expect anyone to know that was what you wanted? However, a search on google for multicolumn autocomplete only returned around 29,000 results, the first 2 of which are articles here on CP, so I guess it would be difficult for you to find some ready written code, which I suspect you are really after.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i have made setup of my project but i want to add copy protection like no body will able to copy cd or it will be installed only once like that so how can i do this?
Thanks & Regards,
Prashant B. Lavate
Software Engineer
Mobile : +919423872257
Pune(India)
|
|
|
|
|
Well, not by cross posting. You need to look at licencing.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ashfield wrote: You need to look at licencing.
Just for conversation: Have you ever used a technique where you store part of your code at the server (which you own) and the client gets it at runtime in order to work (never stores it). So basically the installation is just part of the program, rest will come from the server if you're authenticated and licensed.
|
|
|
|
|
No, although its sounds and interesting way of doing it. To be honest, for over 95% of my work the client gets the source code too, so I rarely have to worry about licencing.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Yeah, I also think it's an interesting idea. Worth trying if you need to protect the source (and the executable also).
Ashfield wrote: over 95% of my work the client gets the source code too
After the payment I hope
|
|
|
|
|
Don't cross post as it is considered rude. You did get some good replies in your other post. Do take a look at the discussion dan neely and I are having, there are some good clues in there
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
The saga continues...
I have finally got all the forms in place and loading in the proper order: Main -> Inventory -> Add Transformer -> Enter Transformer Info. The latter is implemented as a modal dialog with several text boxes for user entry and two list boxes for lookup from the database. I've bound the list boxes to the Volts table in the database to allow lookup of the permissible primary and secondary voltages, using the voltsBindingSource as the DataSource, and the Volts field of the Volts table as the DisplayMember, as instructed by the article in MSDN. The AllowDrop property is True.
What's confusing is that, when I first created the dialog box, running the code displayed the little dropdown arrow and showed all the entries in the table correctly. After fiddling with the navigation for a week or two, trying to get all the forms to display correctly - now working perfectly, thanks to several helpful members here - I no longer have the listboxes populated when I run the code. They look like a textboxes - no dropdown arrow, and no data displayed. I've checked the settings and they're still the same: DataSource=voltsBindingSource and DisplayMember=Volts.
What the heck am I missing here?
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Roger Wright wrote: After fiddling
Roger Wright wrote: I no longer have the listboxes populated when I run the code.
Roger Wright wrote: What the heck am I missing here?
No way to know without being there. A general observation is that this is a good example of how software development requires understanding. Meaning it takes more than just following a set of instructions. Trying to skip ahead to finish without understanding all the individual technologies, constructs and concepts that one uses is a form of Technical Debt[^]. And when the debt comes due, it can be at a far greater interest rate than your typical credit card.
led mike
|
|
|
|
|
led mike wrote: software development requires understanding
Obviously. And understanding arises from study, practice, and feedback. Having studied, and practiced, the notable lack of feedback is unenlightening. No errors, no messages, no nothing...
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|