|
Thanks Lisa, I actually did discover that a while after posting.
I should have updated.
|
|
|
|
|
instead of your
if (propType.IsGenericType &&
propType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
propType = Nullable.GetUnderlyingType(propType);
}
you could also do
column.DataType = Nullable.GetUnderlyingType(PropertyType) ?? PropertyType;
depending on your knowledge about the ?? operator and your preferences it could improve the readability
|
|
|
|
|
Hi guys I've a form for cars search. There are different text boxes and check boxes on that form. User can even enter one field or all the field or no one field. If i use and operator then it doesen't give me any result. can anybody help me. How can i make a query that can give me result.
for example i want to search the cars which have cdplayer. now all the fields are empty only one check box is checked.
|
|
|
|
|
How are you performing your search? Are you using a stored procedure? If so you will need to allow your parameters to be null. Pass all of your fields on the form to your search proc. If one of the fields is blank pass a null value for that parameter. This way you can do a specific search on only the criteria that is selected by the user. I have also done a search page that will allow the user to select Any in a drop down list. The proc then replaces a parameter with the value Any with a * (to search all items in the drop down list).
Hope this helps.
Nathan
|
|
|
|
|
Hi there,
I have a problem. Here's the situation: I have a bunch of controls in a library. I'd like to build some forms using these controls, but I want all the controls to have 3 extra events that I have defined. Ideally, I don't want to have to write a new control class that derives from the existing control and adds the events, because there's a lot of control classes.
If it were possible, I'd like to write something like
<br />
public class ExtendedControl< T > : T { }<br />
<br />
ExtendedControl< TreeView > treeView1 = new ExtendedControl< TreeView >( );<br />
Sadly, naked generic parameters can't be inherited. Sometimes, I long for templates...
I was kind of hoping that I could create an IExtenderProvider-style class that can be added to the component tray of a form, and adds the 3 events to all controls added to the form. But IExtenderProvider only lets you add new properties, right?
Does anyone have any good ideas about how i can automagically add the 3 events? or am i going to have to bite the bullet and write a crapload of almost identical derived classes?
Many thanks in advance
|
|
|
|
|
how about:
foreach(Control c in myForm.Controls) {
if (isApplicableTo(c)) {
c.Event1+=...
c.Event2+=...
c.Event3+=...
}
}
|
|
|
|
|
lol if only it were so easy
perhaps I should have mentioned that I want the designer to support my events (so they appear in the events property control when I select the control in the form).
Thanks
|
|
|
|
|
Hello
And what about creating an base class where your allready existing controls derive from?
All the best,
Martin
|
|
|
|
|
that's possible in some cases, but not in others. For example, I want to be able to add the events to TreeView, or TextBox, or whatever. By including the events in a base class, I force everything that wants to support those events, to inherit from that base class, which isn't good design. Ideally, I need something like a C++ mixin (not possible in C#, i think), or something like the IExtenderProvider, for events.
Thanks for the feedback
|
|
|
|
|
Hello,
What about Control.Events.AddHandler method.
Have never used it myself!
Hope it helps!
Martin
|
|
|
|
|
hmmm interesting I'll take a look... I'm not sure, though, because I'd like the events to be visible in the forms designer, and i doubt they would be if i was adding delegates programmatically. Or have I got the wrong end of the stick?
Thanks for your help!
|
|
|
|
|
I'm also interested in that!
Please, let me know if it works for you.
All the best,
Martin
|
|
|
|
|
Hello all,
One of my projects requires that I come up with functionality that allows a user to enter some keywords for a product and then suggests others that might be useful as well (for web-based searches). I was thinking Google probably had an API like this, but I don't see anything. Anyone know of something like this?
Thanks,
Will
|
|
|
|
|
Check out the Amazon.com website. I know that when I view a book they always show a list of more books that users also bought related to the topic of that book.
Nathan
|
|
|
|
|
Hello,
I'm looking to be able to iterate over all open windows and if i find one that meet a creitria then i want to 'bind' with it and control it programatically.
What i'm looking to eventually do is have the program pick a running Internet Explorer session and then
take control over it.
I've been looking a Interop and have seen articles on how to get the handles of windows but i
don't see how i can then 'take over' those windows.
Any suggestions will be greatly apreciated
|
|
|
|
|
|
Hi,
I am using Microsoft Enterprise Library 3.0 in visual studio 2005.
I am developing web application.
In my presentation/UI layer,i am having a code like this...
protected void Page_Load(object sender, EventArgs e)
{
AppConfigBO objAppConfig = new AppConfigBO();
DataTable dtLLInstance = new DataTable();
dtLLInstance = objAppConfig.RetrieveLivelinkInst();
gvwLLInstance.DataSource = dtLLInstance;
gvwLLInstance.DataBind();
}
In my Business layer, i am having a class called AppConfig which has the code as follows:
public DataTable RetrieveLivelinkInst()
{
DataSet dsLLInstanceList = null;
try
{
OracleDatabase objOraDB = DatabaseFactory.CreateDatabase() as OracleDatabase;
OracleCommand objOraCmd = objOraDB.GetStoredProcCommand("SDV_GET_LLINST_PROC") as OracleCommand;
//Executing the SP
dsLLInstanceList = objOraDB.ExecuteDataSet(objOraCmd);
}
catch (Exception ex)
{
throw ex;
}
return dsLLInstanceList.Tables[0];
}
NOW WHEN I RUN MY APPLICATION,AN ERROR IS THROWN AT THE FOLLOWING LINE:
OracleDatabase objOraDB = DatabaseFactory.CreateDatabase() as OracleDatabase;
ERROR IS :
An error occurred creating the configuration section handler for dataConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. (C:\Projects\SubseaDigitalVideos\SubseaDigitalVideoWebApp\SubseaDigitalVideoWebApp\web.config line 6)
MY CONFIGURATION SECTION IN WEB.CONFIG FILE IS AS FOLLOWS:
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</configSections>
I will be grateful if you kindly help me.
Thanks in advance,
Shyam
|
|
|
|
|
|
You say you are using EntLib 3.0 yet your config file references 2.0 assemblies. This what it should look like for EntLib 3.1.
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />>
Open the config file in the configuration app and reset it.
only two letters away from being an asset
|
|
|
|
|
Hi Mark Nischalke,
Thanks for coming forward to help me...
Eventhough i changed version to 3.1.0.0, the same error is throwing at the same line..
What to do? Any idea???
Shyam
|
|
|
|
|
Hi all,
I've got a Timer which is set to fire an event if another event isn't received in time. If the other event is received, then the Timer is reset. For some reason if the other event is halted then the Timer event never fires! If the other event is never received, then the timeout Timer fires perfectly.
Is there any obvious reason why a Timer should fail to fire?
|
|
|
|
|
Hello,
If you are using a timer in the same thread like the delegates, it will block your timer from fireng I guess.
This can be the effect if you are working in the UI thread and use a Windows.Forms.Timer.
Make a try with System.Threading and System.Timers Timer.
Hope it helps!
All the best,
Martin
|
|
|
|
|
Spot on, many thanks! System.Timers.Timer did the job.
Stupid .NET....
|
|
|
|
|
Hello,
Steve_Harris wrote: Spot on, many thanks! System.Timers.Timer did the job.
Glad I could help!
Steve_Harris wrote: Stupid .NET....
No comment on that, cause I think I know how you meant it!
All the best,
Martin
|
|
|
|
|
Martin# wrote: No comment on that, cause I think I know how you meant it!
I came to C# from C++ / MFC, and although there are a lot of things to like with it, I still don't understand some of the design decisions. For example, first of all you could only derive a class from a single base class. Then people complained so they tacked on Interfaces to let you do it! Well rather than tack on interfaces, why not just let you do multiple inheritance properly?! And in the case of this Timer, implementing a Windows.Forms timer that blocks in the Windows.Forms thread is just daft.
Ah well, got to live with it!
Steve.
|
|
|
|