|
Sorry to interrupt, but the code above will not work.
If your write (100 / 255) you'll get integer division resulting in 0, so the value of the numericUpDown won't have an effect for the color of the brush.
Besides, to get values between 0 and 255 you'll have to reverse the fraction.
So something like (int)(numericUpDown.Value*255/100) should work better.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I was thinking I needed more sleep and you just confirmed it
I got my fraction upside down
Ed
|
|
|
|
|
Hi,
Thanks both of you for your help i already could do what i needed
Regards,
Alberto Martinez
|
|
|
|
|
Hello,
Is it possible, while dragging a node in a treeview, instead of highlighting a drop node, but to display the insert line between the nodes (just like in your favourites menu in explorer) where the node will be inserted?
Please let me know.
Thank you.
|
|
|
|
|
|
hey guys, you know how we can bind DataGride to database by using SetDataBinding() and therefore any record i click on in my DataGride i will have it in my form to delete or
Update.
I haven't been able to do the same thing with DataGridView, it doesn't have such a command !!!
by the way in DataGrid is there any way I can change the header text for my colums, in DataGridView its possible but in DataGrid it ain't.
I'll be extremely happy if you can help me out.
|
|
|
|
|
The DataGridView uses the DataSource property to bind data, but before you start binding things willy-nilly, you should really have a look at the BindingSource object. This item is new in .NET 2.0 and takes much of the hassle out of complex data binding.
You should be able to change the header text for column i in the DataGrid with something like m_MyDataGrid.Columns[i].HeaderText = "blah"; .
--
I've killed again, haven't I?
|
|
|
|
|
I have already tried that, thats exactly what i use with DataGriedView, but there isn't such a thing in DadaGrid !!!
|
|
|
|
|
Yikes... yes, it seems the Columns are only available in the WebControlsDataGrid .
If the DataGrid is bound to a DataTable , you can use the Caption property of the DataColumn objects in the table to set the header text.
Or, you can create a DataGridColumnStyle with the desired HeaderText for each column, add them to the DataGridColumnStyles collection of a DataGridTableStyle , and add that to the DataGridTableStylesCollection of the DataGrid .
And THAT'S why I like DataGridView .
--
I've killed again, haven't I?
|
|
|
|
|
I've looked at some sample code and used the MSDN Library but its not really helping me. I'd like to be able to have code change the MaxLocksPerFile setting in the registry located Under HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Jet/4.0/Engines/Jet 4.0.
I can manually change this value but i would like to change it in the code. This needs to be increased because Microsoft Access has problems handling large amounts of data. I have an access database that has hundreds of thousands of records in it and when a user wants to update data in the database there is an error stating "File sharing lock count exceeded. Increase MaxLocksPerFile registry entry." Increasing the value significantly does fix the problem but it would be nice to change this value automatically with code when the user wants to update the database instead of having to go change the registry manually. Any help would be greatly appreciated.
|
|
|
|
|
Simple.
Use the Registry classes in the Microsoft.Win32 namespace.
Or you can refer to this[^]!
Hope this helps!
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
I have same problem. Can you help me?
acdb.ExecuteSQL($@"ALTER TABLE {tableName} ADD COLUMN ROW_NUMBER AUTOINCREMENT");
|
|
|
|
|
Hi,
I did not find answer to my question so why I here.
I try to write program that will load (bitmap,jpg-file, etc.) than I'd like to change this image (draw line, point, circle etc. on it) and than save it to disk. Has someone example of this issue?. I know how to load such image draw something on it but when I save it to disk I get file that is orginal image without changes. Moreover changes disapear when I minimize my image.
Thanks for help.
JM
|
|
|
|
|
|
Hi everyone,
I'm using the System.Web.Mail classes to email users.
The problem is that when I send to an Yahoo recipient, my email goes
straight into the bulk folder.
Is there a way to make sure that my email will go to the recipient's
inbox?
Danny
|
|
|
|
|
I have written a multithread program using lock(this) to realize sync.
I hung up the other day and i was told lock(this) is not a good way.
Can anyone give me some advice and tell my why?
Thank you!
|
|
|
|
|
Bob_Sun wrote: i was told lock(this) is not a good way.
And why didnt he back up his claim? It all depends what you need lock'd, but more important where the locking takes place.
|
|
|
|
|
|
What was wrong with the question you posted only half an hour before? Don't spam the forum.
---
b { font-weight: normal; }
|
|
|
|
|
Soory for made a mistake to post 2 messages.
I think it is better to use this thread only
|
|
|
|
|
Bob_Sun wrote: I think it is better to use this thread only
I already replied in the first thread.
---
b { font-weight: normal; }
|
|
|
|
|
Thank you very much.
I have read your following reply.
Who told you that it wasn't a good way, and what was the arguments for that?
I was just told so, and I found the following forum.
http://msdn.microsoft.com/msdnmag/issues/03/01/NET/[^]
Locking should of course be kept as a minimum, and to avoid deadlocks a thread should never lock more than one object at a time. Still, for sharing data between threads there is hardly any alternative.
I wrote a class for statemachine, whenever a event is dispatched, the whole statemachine should be locked in the thread. As for number of objects locked in this thread, it is always more than 2. As this is a statemachine, state changes must be sent to upper class. As the so called upper class collects messages from many child classes, messages are first enqueued before processed.
So, in this thread
lock(this)
{<br />
...<br />
lock(this)
{<br />
...<br />
}<br />
}
When several events occured in different threads, I suppose all of them will be locked at the first
lock(this) // Statemachine
before processed. Will this cause a deadlock in my program ?
|
|
|
|
|
If those are the only lock statements in the code, and they always get called in that order, it won't cause a deadlock. But if they always get called in that order, the inner lock is of no use at all.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: If those are the only lock statements in the code, and they always get called in that order, it won't cause a deadlock. But if they always get called in that order, the inner lock is of no use at all.
First, the second lock(this) is not necessarily called every time, but when called the order is always the same. Second, the second lock(this) may also be called directly from other threads which have no relation to StateMachine(outside statemachine).
|
|
|
|
|
lock(this) can bring you in a deadlock
instead create a field like this:
private object syncRoot = new object();
and use
lock(syncRoot)
[EDIT] Not static field will be static only for static methods
|
|
|
|