|
Hi bhoomi
I think you want to select values of combos on first form on the closing of second form....
is it???
Atul
|
|
|
|
|
What is the behaviour of STA Threading Model. Does it fill up 1st values of the attached Datasource on Activate?
Then it is a dangerours thing.
If any user has set out ComboBox to be blank and opens another form then those Blanks goes away. How is the user supposed to know which all values might have changed.
Is there any solution for this??
Any help would be highly appreciated.
Regards,
Bhoomi.
|
|
|
|
|
Hi Bhoomi
I think u want to change the index of combos of first form on closing of second form. If this is question then events and delegates are used int this scenario....
Atul Kumar
|
|
|
|
|
For knowing the exact problem, i have created another application as follows :
1. MDI Form with 2 menus : Form1.cs and Form2.cs
2. Form1.cs
2 Comboboxes filled through DataTable.
3. Form2.cs
Just a TextBox.
Behaviour is like this :
Open Form1.cs in MdiParent. ComboBoxes gets filled up. Remove the selected value manually. Open Form2. Close the Form2. Both the comboBoxes are filled up with 1st values.
I am unable to undertstand why the combo boxes are filled up with initial values on its own.
Any help would be highly appreciated.
Regards,
Bhoomi.
|
|
|
|
|
Not sure why exactely but this is not the only strange behavior I see.
I now that forms run on the STA threading model so a form that doesn't have the control is actually not "running". I think that when a form regains the control, it reinitilizes partly its controls, so behaviors like this are to be expected. I learned with time to be very carefull about this. There must be reading to do on this but I never took the time to do it. try to at least understand the difference between STA and MTA, it will answer many of your questions on forms.
Good luck
|
|
|
|
|
hi i want to get the index valu of the sorted array in some other array
can any 1 help me with this.......?
i need the sorted index to be in another arry....
Array index
0
1
2
3
4
5
6
Values
2
1
7
6
5
4
3
sorted index
2
3
4
5
6
0
1
sorted value
7
6
5
4
3
2
1
Arun Raj.K
|
|
|
|
|
I am trying to build a DataTable from a TList<t>, which is a collection of T business objects. I am using reflection to get all the properties of T, and then loop through them creating DataColumn objects. However, I get an error when I try and create a new column where a property of T is nullable. Is there a quick way around this? Looking at the type name for a nullable property of T is also pretty confusing, as the type name is "Nullable`1".
"A little learning is a dangerous thing; drink deep, or taste not the Pierian spring: there shallow draughts intoxicate the brain, and drinking largely sobers us again.", by Alexander Pope
My New Blog
|
|
|
|
|
You need to get the underlying type, e.g.:
foreach (PropertyInfo propInfo in properties)
{
Type propType = propInfo.PropertyType;
if (propType.IsGenericType &&
propType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
propType = Nullable.GetUnderlyingType(propType);
}
}
|
|
|
|
|
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
|
|
|
|