|
OK i got the threading figured out.
now i got the download rining in its own thread, The program is responsive while its downloading and the animations move on the form.
but i still have the same problem. how do i get the download status from the class in the new thread?
is there some way of sending info from a C# class to a vb form?
for example, have the class update a label on the form with amount downloaded so far.
|
|
|
|
|
hi !
How can I open excel file, show it on DataGrid, then save it into Database(SQLServer) ???
|
|
|
|
|
You can have a look into the COM component "Microsoft Excel 11.0 Object Library" which is avilable in IDE COM tab once you have office installed in your machine. This class will expose lot of operations which we can deal with excel files. please find MSDN for more info and code samples.
Please read this article too Working With excel
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I create a user control object and show its properties through a propertygrid
object in my application. It is sure that there are 100 hundred of properties
inherited from System.Windows.Forms.UserControl and they are all showed on
the propertygrid. Is there a way i can hide all these inherited properties
and show only my user control's properties ?
|
|
|
|
|
Override the properties you want to hide (calling the base class where appropriate) and add the following attribute:
[Browsable(false)]
Note that this will only hide the property from the visual form editor, it will still appear on the Intelissense and anyone will still be able to use it.
Yes, even I am blogging now!
|
|
|
|
|
Is that the only way i can do? because I have 10 - 20 user controls and i need to hide all of inherited properties. This would be a huge task !!!! T_T
|
|
|
|
|
Tee+ wrote:
Is that the only way i can do?
Maybe not, it's the only way I know
Tee+ wrote:
because I have 10 - 20 user controls and i need to hide all of inherited properties. This would be a huge task !!!! T_T
You can try deriving a (non-abstract) class from UserControl, and hide the properties. Then, you derive all your controls from this class, instead of UserControl. It should work, but I didn't try it.
Yes, even I am blogging now!
|
|
|
|
|
humm .... let's see whether i get your idea, because i am kind of new ^^''
public class myUserControl : System.Windows.Form.UserControl
{
public myUserControl {
get all UserControl properties and override the "BroswerAttribute" for all properties
}
}
so then my created UserControl will derive from myUserControl instead of Window UserControl ?
Is this right ??? ... if so i think i will try tomorrow and i will let you know.
|
|
|
|
|
Tee+ wrote:
so then my created UserControl will derive from myUserControl instead of Window UserControl ?
Exactly. An additional advantage of doing things this way is that any similar behavior of your 20 controls (e.g., methods, properties, etc) can be added to myUserControl. This also can make easier for you to write generic code.
Yes, even I am blogging now!
|
|
|
|
|
Here is my code:
AttributeCollection attributes = properties.Attributes;
BrowsableAttribute myAttribute = (BrowsableAttribute)attributes[typeof(BrowsableAttribute)];
properties.Attributes[typeof(BrowsableAttribute)] = BrowsableAttribute.Yes;
It said it is read-only. Can i reset the browsableattribute in this way or i miss something?
|
|
|
|
|
use System.Design.dll to hide the unwanted property which is avilable from any base to your derived.
<br />
using System;<br />
using System.Windows.Forms.Design;<br />
<br />
namespace CusControl<br />
{<br />
public class MyControl:ScrollableControlDesigner<br />
{<br />
public MyControl()<br />
{<br />
}<br />
<br />
protected override void PreFilterProperties(System.Collections.IDictionary properties)<br />
{<br />
properties.Remove("BorderStyle");<br />
}<br />
}<br />
}<br />
<br />
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I have tried what you have gave me ... Here is my code:
protected override void PostFilterProperties(IDictionary properties)
{
PropertyDescriptor _locked = (PropertyDescriptor)properties["Locked"];
PropertyDescriptor _name = (PropertyDescriptor)properties["Name"];
PropertyDescriptor _tabindex = (PropertyDescriptor)properties["TabIndex"];
PropertyDescriptor _location = (PropertyDescriptor)properties["Location"];
PropertyDescriptor _size = (PropertyDescriptor)properties["Size"];
properties.Clear ();
properties.Add ("Locked", _locked);
properties.Add ("TabIndex", _tabindex);
properties.Add ("Location", _location);
properties.Add ("Size", _size);
properties.Add ("Name", _name);
base.PostFilterProperties (properties);
}
Anything look good but what i found is the "Name" properties doesn't restore successfully ... what happen with that ?
|
|
|
|
|
properties.Clear (); This line put me in confusion. Just comment this and try. And the Name property is used to idetify a control no matter if it design time or run time. So i am not sure about removing Name property from Base.
please refer MSDN System.Design.Dll namespace.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi
How i can open window folder programmatically??
Thank
|
|
|
|
|
Call System.Diagnostics.Process.Start(folderName), e.g.:
<br />
System.Diagnostics.Process.Start("C:\\windows");<br />
Yes, even I am blogging now!
|
|
|
|
|
|
...writing an ASP.NET enterprise apps, one of the desired feature is database vendor independence. I've tried surveyed and tested two options:
1. Mimer (take a look at their docs, it's quite simple to use)
2. Data Access Components By stephanpeters4000
Both are nice. But:
a. Steph's DAC has a low rating it seems.
b. Can't find much documentation on Stephan's DAC, so, if you need to switch from M$SQL to, say, Oracle... then you'd need to dig into his code... I'm not even sure if factory for Oracle and MySQL is implemented. (There's Ole/ODBC provider however) - in any case, if you want ADO.NET with Oracle and MySQL, you need to spend some time to implement:
- connection string factory
- connection factory
c. Also, seems like Mimer is a more established project with a larger following and much better documentation/support.
d. Good thing is, with Stephan's DAC, deployment is simple as DAC comes in as a class library. Mimer, on the other hand, comes in as a MSI package. This include a datasource manager - "Mimer Data Provider Manager", and a bunch of binaries which gets installed in GAC... Not sure if there's any issue with deployment yet, but I have a feeling that it will complicates matters in that regards. I can imagine you'd need to do a few things:
- install Mimer and programmatically configure Mimer's datasource (Mimer Data Provider Manager) DURING installation process (installation of my enterprise app - not Mimer)
- connection factory (implements IDbProviderFactory)... perhaps not... not sure yet.
e. Also, Mimer doesn't has a connection factory class.
f. Mimer definitely has support for Microsoft SQL Server, Oracle and MySQL - so, besides installation/deployment... Mimer seems to be the better choice.
Any advise?
Norman Fung
|
|
|
|
|
norm wrote:
Any advise?
Yes: database independence is not easy to achieve, and, unless you'll be running only the simplest queries, you'll need to use specific database features, especially when you're coding reports.
More than this, don't forget that you'll need to provide scripts for database creation, version upgrades, maintenance, etc. All those scripts will be database dependant.
So, my suggestion is: code your DAL in terms of interfaces, and rewrite those interfaces for each database you'll support.
Yes, even I am blogging now!
|
|
|
|
|
Thanks Daniel. I'll be wrapping a lot of stuff in Stored Proc's and in application level, I'm using interfaces only: IDbConnection, IDataReader...
With DAC's, I still need to code Connection factory because:
IDbConnection = factory.CreateConnection(conn string here)
Connection strings are vendor-dependant. Adding to it, seems like ADO.NET data provider for Oracle/MySQL isn't implemented in DAC's class library.
Mimer is nice, and seems more established (with a larger following) but it seems like there're more work to do with respect to deployment.
Norman Fung
|
|
|
|
|
Hi,
How to insert a separator in a combobox???
thanks,
Bye.
|
|
|
|
|
Would an empty item help? Or an item that reads "(separator)".
You would have to validate when retrieving the selected value that it's not a separator.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
asfasfafafasfa
asfasfasfasfafs
________________ <---- this is a separator but i do this with many undescores
afadsfasdfasdfasdf
|
|
|
|
|
Use an empty string.
cmb.Items.Add("Option 1");
cmb.Items.Add("Option 2");
cmb.Items.Add("Option 3");
cmb.Items.Add(" ");
cmb.Items.Add("Option 4");
cmb.Items.Add("Option 5");
if((string) cmb.SelectedItem == " ")
{
MessageBox.Show("Select a valid option.");
return;
}
DialogResult = DialogResult.OK; Alternatively you could use an ownerdrawn combo box and paint the separator in a way that it can't be selected, but I think it's way too much work.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Sorry,
this alternately I don't like. Really I have already do this but I don´t like I see a C++ project which it is possible to introduce a separator. You can see this in
http://www.codeproject.com/combobox/zsepcmb.asp[^]
Do you know how to convert a c++ project in c#?
Thanks
|
|
|
|
|
Dany Ramos wrote:
I see a C++ project which it is possible to introduce a separator.
It can be done in C# too. But you need to subclass the control. That article you mention syas how he did it, by subclassing the control and using WM_CTLCOLOR message to paint the separator; that is to avoid the use of an ownerdrawn combobox, which is a much more work for something so simple.
Alternatively you could try writing an ownerdrawn control. I've never done this myself so I can't offer much help. But for a start, see the documentation for the DrawMode property and DrawItem event of the ComboBox control.
It'd go something like this: set the DrawMode to OwnerDrawFixed when you create the item. Insert your separators as a regular item with " " as text. When you get the DrawItem event for your separator, draw a single line in the middle of the rectangle. When you get that event for a regular item, check its State to see if it's selected or not, and paint it accordingly.
Dany Ramos wrote:
Do you know how to convert a c++ project in c#?
It's not possible to convert a C++ projecto into C# automatically (at least not in the general case.) But you can see how it's done in C++ and reimplement it in C#.
I hope this helps,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|