|
Wow
This is exactly what i wanted
Than you
|
|
|
|
|
I like this!;P
But i have another little problem with this:
I don't know how to handle events of this control.
i know how to change properties of this using <param>:
<param name="Text" value="ButtonText">
or using JavaScript:
myCtl.Text='NewBtnTex';
But i do not know if i can handle events and (if it is possible) how to do it
Thank you
|
|
|
|
|
Google for "SimpleControl".
Then google for "Chris Sells", because he's written a few articles on this subject (MSDN and MSDN magazine) Also look at http://www.sellsbrothers.com/wahoo[^],
Make sure you know something about .Net code access security, permissions and codegroups, because you're gonna see security permission exceptions...
VictorV
|
|
|
|
|
When authoring custom controls it is possible to specify a custom (16x16) bitmap that will then be displayed for the control in the Toolbox. However, if you specify a file path (like @"C:\MyProject\resources\toolbox.bmp") it appears the VS.net looks for that file at the specified location at runtime rather than building the image into the control.
Obvioulsy after redistributing the control, the bitmap does not exist any more as they don't have the source code, or if they do they probably don't have it in the same location as the author.
How can I successfully specify a custom bitmap, but be able to redistribute the control?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
The easiest way to achieve this is to not bother using the ToolboxBitmap attribute and just include a bitmap in the project (at the same level) for each control named the same as the control class, i.e. MyControl.bmp for MyControl.cs.
Be sure to set the 'Build Action' to 'Embedded Resource' for the bitmaps.
Then the Toolbox will automatically use that image.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hey Folks,
I initaly posted this in the C# group but realised that this may be more appropiate here.
I have a few old (very handy) programs that I have written using perl and python that I want to port to C# just for the sake of doing it.
In one of the instances, I need to enumorate across a directory and get the the total size of the files in the directory. Using a simple "foreach" loop like:
<br />
long total = 0;<br />
...<br />
...<br />
foreach(FileInfo f in directory.GetFiles())<br />
{<br />
total += f.Lenght;<br />
}<br />
...<br />
...<br />
And I have to say that this is SLOW. When recursing medium to large directories it can take as much as 10x the time my perl and python programs take.
My guess is that it is due to fact that the call to the Length property is not so light-weight as one might think. So, the call inside the loop is killing me.
Has anybody else ran into this hiccup?
And, does anybody have any suggestions about how to design around this?
Any help would be appreciated
Many Thanks
Chris
|
|
|
|
|
Hi Folks
Is there any library , class or assembley in .NET framework by which to obtain free disk space of a hard drive?
What do you think about: System.Management.Management object?
Please guide me.
thanks
arash
Arash Afifi
Software Engineer
E-mail: afifi@sympatico.ca
|
|
|
|
|
already answered[^].
How low can you go ? (MS retrofuck)
|
|
|
|
|
I have a form that binds controls to a dataset. Some of the fields in the dataset are date fields, so I am using DateTimePicker controls to display (and allow editing of) these fields.
However, the date field in question can be null. When this occurs navigation through the records in the dataset is stopped, that is setting the Position property on the BindingContext does not update the controls.
Is there a workaround that allows binding to null dates?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi
How about modifying your dataset to insert a date as a default value, in case the field is NULL? Just a thought, mite work, mite not
Cheers
"There are no stupid question's, just stupid people."
|
|
|
|
|
Thanks for the idea, unfortunately a null date has meaning, so actually displaying a date would be confusing and misleading to the user.
Any other ideas?
I'm beginning to think I may have to do this myself. Any ideas what's involved in creating a data bound control?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi again Derek
I just ran into a similar problem , but I have found a solution for binding a NULL value. Look at the following:
private byte rating;
[Bindable(true)]
public object Rating
{
get { return rating;}
set {
if (value == DBNull.Value) rating = 0;
else rating = (byte)value;
}
}
Hope this helps
"There are no stupid question's, just stupid people."
|
|
|
|
|
Q313513[^] might help. The code's in VB.NET, but it shouldn't be too hard to convert.
|
|
|
|
|
Better yet, here's some C# code that seems to work:
using System;
using System.Windows.Forms;
public class DateTimeBinding : Binding
{
public DateTimeBinding(string propertyName, object dataSource, string dataMember)
: base(propertyName, dataSource, dataMember)
{}
protected override void OnFormat(ConvertEventArgs e)
{
if (e.DesiredType == typeof(DateTime))
{
if (e.Value is DBNull)
e.Value = DateTimePicker.MinDateTime;
}
else if (e.DesiredType == typeof(bool))
{
if (e.Value is DBNull)
e.Value = false;
else
e.Value = true;
}
base.OnFormat(e);
}
protected override void OnParse(ConvertEventArgs e)
{
if (e.DesiredType == typeof(DateTime)
&& e.Value is DateTime
&& (DateTime)e.Value == DateTimePicker.MinDateTime)
e.Value = DBNull.Value;
else if (e.DesiredType == typeof(bool)
&& e.Value is bool
&& (bool)e.Value == false)
e.Value = DBNull.Value;
base.OnParse(e);
}
}
Then, you just need to add the appropriate bindings:
dtp.ShowCheckBox = true;
dtp.DataBindings.Add(new DateTimeBinding("Value", ds, "[Date Field]"));
dtp.DataBindings.Add(new DateTimeBinding("Checked", ds, "[Date Field]"));
I haven't tested updating the data, but the display seems to work fine.
|
|
|
|
|
Thanks, I'll take a look and let you know how I get on.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Thanks very much (once again). I've had chance to try this out now and it certainly seems to work (though like you I haven't tested updating yet).
One thing that would make it a perfect (for me anyway) implementation was if the DateTimePicker.Text property could be set to "(null)" for null dates. Any ideas how to do that?
I tried setting this.Control.Text in the OnFormat override, but that caused the original problem to occur again Any ideas?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
|
I have an Access database that I'm trying to bind to in a Windows Form.
I've added all the necessary connections, data adapters and datasets and establish relations in the schema.
Unfortunately the table I want to be able to navigate and edit includes several fields that are lookups to other tables. I have the main table fields working fine with navigation done using the BindingContext Position property and I can bind a combo box to the lookup table to give the right values, but how do I get the lookup combo to display the correct value for the current record in the main table?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi,
When I upload a file via ASP.NET HTTPPostedFile.SaveAs(foo.jpg)
The file foo.jpg is locked by another process for approx. 30 seconds.
I have ruled out;
VS.NET being in Debug Mode
AntiVirus Software...
I was just wondering if anyone else has run into this problem and if they found a remedy ?
Thanks in Advance
Angus Logan
|
|
|
|
|
Hi Angus,
Try to make Windows Indexing Service Manual. I had a similar problem that after every 'Build' Operation, my Web Application complained
'Access to /Temporary ASP.NET ... denied.' A suggestion in one of the forums suggested that if Indexing Service is enabled, it tries to index the newly built files from Visual Studio and during this period, the files are not accessible.
Most probably, the same scenario applies to you too. Just after call the PostedFile.SaveAs, the Indexing Service tries to index the newly created resource, resulting in a deadlock for your application from accessing the same.
Making Indexing Service Manual or stopping it should help you too.
Deepak Kumar Vasudevan
|
|
|
|
|
I am looking for a way to protect my .NET softwares from decompilation and disassembling.
I know there are many obfuscators available.
There is also a product named "Salamander .NET Protector" which is not an obfuscator.
Is there anybody that knows that product? Is it a good solution to protect the source code?
|
|
|
|
|
Can you give me the URL for Salamander .NET Protector, please?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
http://www.remotesoft.com/salamander/protector.html
|
|
|
|
|
|