|
Hi all
Is exists a way to bind property to control through (this[string])
Ex:
<br />
<br />
protected override void OnLoad(EventArgs e)<br />
{<br />
base.OnLoad(e);<br />
<br />
DataSrc ds = new DataSrc();<br />
<br />
this.DataBindings.Add("Text", ds, "Prop1");
<br />
}<br />
<br />
...<br />
...<br />
...<br />
<br />
public class DataSrc <br />
{<br />
public object Prop1 { get { return "Prop1"; } }<br />
}<br />
<br />
But i realy need to bind control not throug explicit defined property (in case above Prop1) but through this[string PropName] property
Ex:
<br />
<br />
protected override void OnLoad(EventArgs e)<br />
{<br />
base.OnLoad(e);<br />
<br />
DataSrc ds = new DataSrc();<br />
<br />
this.DataBindings.Add("Text", ds, "Prop1");
<br />
}<br />
<br />
...<br />
...<br />
...<br />
<br />
public class DataSrc <br />
{<br />
public object this[string PropName] <br />
{<br />
get <br />
{ <br />
switch(PropName)<br />
{<br />
...<br />
case "Prop1":<br />
return "Prop1"; <br />
}<br />
} <br />
}<br />
}<br />
<br />
Is exists way to do such way????
THANK
|
|
|
|
|
How would you define the PropName? Isn't the whole point of "Prop1" in
this.DataBindings.Add("Text", ds, "Prop1") is to let you define in string which property that you want to bind to?
|
|
|
|
|
Obviously i was not very clear.
this.DataBindings.Add("Text", ds, "Prop1") - for my purpose "Prop1" - should be not property name, but parameter what should pass to this[string PropName] method. The same way as this act when datat source object is DataRow.
|
|
|
|
|
You were very clear, obviously I was not very clear.
You can't just take an indexer and use it as property because they look roughly the same. If you really really want to do that, you probably should create a property for each of the indexer.
|
|
|
|
|
-you probably should create a property for each of the indexer
Good News Evryone (c) futurama
It's realy hard when you have about 50 fields.
Probably had to implement this throught DataRow class.
|
|
|
|
|
ORM code generator, map the fields in datarows into data objects.
BTW, if you map them to data objects, remember to implement OnPropertyChanged or OnXXXXXXChange, or the updating won't be bi-directional.
modified on Friday, May 23, 2008 7:38 AM
|
|
|
|
|
ORM code generator - what is this???
Actualy for my objective realy convient to use indexer, since all this invokation i suppose
to delegate for internal object what also have same indexer.
public System.Drawing.Color MyStubObject::Indexer[string FieldName]
{
if (ContainedDataRow[FieldName, Original] != ContainedDataRow[FieldName])
{
return System.Drawing.Color.LightGreen;
}
else
{
return System.Drawing.Color.White;
}
}
....
control1.DataBindings.Add("EditValue", dataRow, "CLIENT");
control1.DataBindings.Add("BackColor", dataRow.stubObject, "CLIENT");
control2.DataBindings.Add("EditValue", dataRow, "ACCOUNT");
control2.DataBindings.Add("BackColor", dataRow.stubObject, "ACCOUNT");
This way i have all modifyed fields on form with lighted beckground.
|
|
|
|
|
ORM Wiki[^]
Basically you will be working on an object that is mapped to your data, instead of working on datatable, datarow, datacolumn, etc.
You may want to look at whether you can write your own DataBinding for binding to the columns of datarow, good luck.
|
|
|
|
|
Hi ,
I am using the following code to merge a number of word docs.
Word._Document wordDocument = wordApplication.Documents.Add(
ref missing
, ref missing
, ref missing
, ref missing);
Word.Selection selection = wordApplication.Selection;
foreach (string file in filesToMerge)
{
selection.InsertFile(
file
, ref missing
, ref missing
, ref missing
, ref missing);
if (insertPageBreaks)
{
selection.InsertBreak(ref pageBreak);
}
}
selection.
wordDocument.SaveAs(
ref outputFile
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing
, ref missing);
Testing showed that for certain documents all formatting was preserved yet for some documents it changed the font to Times New Roman size 12.
Any ideas to what would cause this as I am stumped.
Thanks in advance.
Ryan.
|
|
|
|
|
Hi ,
I am facing a problem . I have a windows application, from that
application i want to connect to one running instance of Mozilla
browser. I also want the event notification back from Mozilla browser
to windows application.
Please suggest some ideas .
Thanks & Regards
Mihir
|
|
|
|
|
|
Hello,
I have a .xsl document and I need to retrieve the data row by row (I would like to have the name of the column and the value for each record to use these information later)
Please help me, if you now how it is possible to do
Thanks in advance,
Bye
|
|
|
|
|
There are two ways to read xls files:
1.Excel Object model
2.Ole db adapter for excel
There are many sample on the web and codeproject. If you searched, you would find them.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I've used this[^] before. The free version works fine but is limited to how many rows and sheets - the pro version costs.
Dave
|
|
|
|
|
Hi,
I am Developing an windows application i want when ever my application runs then form opacity will increase slowly from 0 to 100% on timer tick.
Thanks & Regards
|
|
|
|
|
In the event handler of the timers tick event increase opacity of the form according to your needs. Make sure you don't increase it after you reach 100%
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hi, I'm developing a pocket pc(windows ce) application in visual studio with c#.
I build my forms controls(tabs,literal,textbox)from c# code (I parse an xml file and generate in on fly).
In whic mode i can put my objects in precise mode inside form?
For example:
literal -> textbox
literal -> combobox
literal -> textbox
ecc..
(2 cols and n rows ecc )
In compact framework i can't find Form.TablePanel.
There are other controls that allow it?
Suggestions?
Thanks!!!
|
|
|
|
|
Hi,
I want to do a peculiar thing..
I want to run my console application in my system tray..
Can anyone tell me how to do this?
(My console app is more than a normal console app, it does many things in background, so want to do this)
Thanks..
modified on Friday, May 23, 2008 4:15 AM
|
|
|
|
|
When i built a Setup Project(C#.NET), i get a setup.exe. After that , Explorer -> right click(on the setup.exe) -> Properties -> Version Tab.
There're some information within the version tab including File Version, Company, Product name, Product Version , etc.
- Could we change all of those information (Before rebuilding Setup Project) ? and How/Where to change it ?
Thank
^^
modified on Friday, May 23, 2008 3:43 AM
|
|
|
|
|
bug_aonz wrote: When i built an Setup Project(C#.NET),
Do you mean you created a C# project to create a setup program? Or do you mean you used the setup project template (which is language neutral, so C# really has nothing to do with it).
Since you indicated C# specifically and you posted this in the C# forum, I'm going to assume you wrote your setup.exe in C# rather than use the setup project template.
The values that appear in the properties are typically set in the assemblyinfo.cs file. There are a number of assembly wide attributes that are set in that file that will indicate the values that will appear in the properies.
|
|
|
|
|
Yes, I'm using C#.NET Setup Project to create a setup program.
I've already change some info in the assemblyinfo.cs . it've just shown in the properties of my application.exe file (executable file of my application) but it didn't change the properties of setup.exe.
Why?
^^
|
|
|
|
|
bug_aonz wrote: C#.NET Setup Project
That is still ambiguous because no such thing exists.
|
|
|
|
|
Ok.
If you were me, how could you have this thing(change properties of setup.exe) done on your own way?
thank for your answer
^^
|
|
|
|
|
Hi!
The setup.exe is just a bootstrapper for the actual msi file and you cannot modify its properties.
What you can (and should) modify are the properties of your msi file, although by default explorer shows the PackageCode (I think) as the version of your setup, not the Version property.
If you want the product version to be visible in the default file info, you could add it to your setup's title.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I have to write an application that read a file and performs some action on it..
The file can be quite be so i have to read Xsome bytes at a time and perform the action on it...
How many nbytes recommended to read in order to achive max performance?
Thnaks
|
|
|
|