|
Explicit interface implementation allows you to implement an interface without adding public methods to your class. You will be able to call the method by casting an object instance to the interface type.
((IComparable)myInstance).CompareTo(other)
This is mainly used in two cases:
- there is another public method that does the same job and should be called instead (FileStream.Close vs IDisposable.Dispose)
- the method is expected to be only called by some other code that always operates on the interface and doesn't know about your class, and you don't want that the methods show when using your object. (often used with ICustomTypeDescriptor)
|
|
|
|
|
Daniel Grunwald wrote: You will be able to call the method by casting an object instance to the interface type.
((IComparable)myInstance).CompareTo(other)
I remember now. I did this last night...
IComparable<range> test = this;
test.[Intellisence found it];
It compiled without errors.
Thanks for the information.
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
I've been trying to use the Update method of the OleDbDataAdapter to update a MS Access database, but have not had success. I'm updating a DataTable object through several data bound controls and want to update the database using the values in those bound controls by simply clicking a 'Save' button. The Update OleDbDataAdapter method seemed the most appropriate method to use, but it hasn't worked. I don't get an explicit error, but no changes are made to the source database. Would anyone be able to suggest a reason for this? Thanks.
|
|
|
|
|
I assume that you assigned a command object to the UpdateCommand property of the DataAdapter.
If you have done that, then please check if you have access to update the table.
|
|
|
|
|
How would I check if I have access?
|
|
|
|
|
If it's a windows application just try a simple update query and see if you can update it
If it's a web application, try to give ASPNET account proper privileges
|
|
|
|
|
Thanks. Actually, that was not the problem. Basically, I wanted to use a DataGridView to display changes to the underlying data source, while using the data bound text box controls for editing purposes. Unfortunately, the way I set it up, the data table was not getting changed by changing the text box values.
Still, I have encountered another problem, and that is a concurrency violation. What could be the source of the concurrency violation?
|
|
|
|
|
concurreny problem occurs when more than 1 users are trying to update the same record, it might happen that one will end up changing a record that has already been modified by other users.
To fix concurrency violation, in your update query check if the record that you had read (and you're about to modify) has been modified or not. If it has been modified, don't update. Otherwise update it.
This is called optimistic concurrency control.
|
|
|
|
|
Thanks. I am certain that no other user is modifying the record. Could there be a concurrency violation because of some coding error?
|
|
|
|
|
can you please post the query that you're using and also the error message
|
|
|
|
|
Hi,
In my windows application if I'm getting ExternalException when I use the following to methods if the text parameter is too large.
g.MeasureString(text, font, size, format);
g.DrawString(text, font, color, rectangle, format);
I have tried to make the size and rectangle parameters to be large so that it fits the text, but I still get the same exception with Message : "A Genric error occurred"
Please let me know how I can fix this.
Thanks
Ben
|
|
|
|
|
How big is your string ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Length of the string 103325
|
|
|
|
|
Well, that's just silly
That error generally means you've used too much of a resource, or you've tried to use a resource that's not available to you. With that many chars, I am not surprised.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Is there any work around?
|
|
|
|
|
Instead of trying to draw one large string why don't you break it up and draw them individually?
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
I can, but I'm more interested in find out if there is a cutoff on the length of the string that gdi+ can handle thru these 2 methods.
|
|
|
|
|
GDI+ works with strings that are either "Pascal strings" (length + data) or "C strings"
(null terminated), so it has a explicit notion of string length (which gets set to -1
for C strings).
And I would not be surprised there are some 16-bit limitations to integer quantities
(hence max 65535 or even 32767 since -1 suggests signed integers are used for lengths).
one thing I found after a quick Google was:
"Due to a limitation of the GDI+ decoder, an System.ArgumentException is thrown if you construct a bitmap from a .png image file with a single dimension greater than 65,535 pixels."
If you really want to know, continue searching, or perform some experiments.
I would suggest trying string lengths of 32700, 32800, 65500 and 65600.
Luc Pattyn
|
|
|
|
|
|
Hi,
I have added a reference for a managed c++ dll to a c# project. I can view the c++ classes and their methods in the object browser. I can also create an instance of the class objects in c#. However, intellisense does not show the object's methods, and if I try to call them, I get an error about them not being defined.
Anyone experienced this in the past? Any suggestions?
Thanks,
-----------------
Genaro
|
|
|
|
|
Are you using the namespace they are in, or scoping it explicitly ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
They are not wrapped in a namespace. Do they have to be?
-----------------
Genaro
|
|
|
|
|
I expect so. There's no global namespace in C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi everyone.
I've been asked to research for a way to retrieve information from a remote pc, which only has modem conectivity, without internet access.
I would just like to know if there's any way of doing this with c#. A good hint to start research would be helpfull as well.
Thanks for everyone's time.
daniel sovino
|
|
|
|
|
I know regular way is to open StringBuilder&StringWriter, etc. Which work fine for flat text.
But overall I believe I need to specify one printFont at end of this method and that is all.
What if I want to print document with pictures and lot's of different fonts (multipage...). Is there some better way to do this?
Thanks!!!
|
|
|
|