|
If your project was going to be transferred to a Pocket device, you'd probably want the .EXE sections packed to 512 byte boundries to save space.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So it's only a filesize matter. At least now I know it.
Tozzi is right: Gaia is getting rid of us. Do you feel the way you hate or do you hate the way you feel?
|
|
|
|
|
Class B includes a method "public void Save()".
Class A includes one field which type is B.
In some other class I am using reflection to gather information about class A and B:
<code>
{
Type ClassType = typeof(refl.A);
FieldInfo[] fields = ClassType.GetFields();
foreach(FieldInfo f in fields)
{
Type t = f.FieldType;
MemberInfo[] members = t.GetMembers();
foreach (MemberInfo m in members)
{
if (m.Name == "Save")
{
<big> ?????
</big>
}
}
}
}
</code>
When I find a function Save, i would like to call it. This isn`t a static method so I need to call it over some object. How to make it inside reflection?
|
|
|
|
|
|
You could do something like this.
<code>
public class B
{
public void Show()
{
System.Windows.Forms.MessageBox.Show( "B.Show called!" );
}
}
public class A
{
private B mB;
public B MemberB
{
get
{
return ( this.mB );
}
set
{
this.mB = value;
}
}
public A()
{
this.mB = new B();
}
}
public Class Tester
{
private A mA;
public void Do()
{
object lB;
lB = this.mA.GetType().GetProperty("MemberB").GetValue(this.mA, null );
lB.GetType().InvokeMember("Show",System.Reflection.BindingFlags.InvokeMethod, null, lB, new object[] { } );
}
}
</code>
I hope this helps.
<i>Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons </i>
|
|
|
|
|
Thank you both, it seems to be working
One more question - suppose that properties does not exsist.
public class A
{
int i;
void show() { ... }
}
public class B
{
A a;
}
How to (using reflection on class B) call a non-static function on member a? (like:
B b = new b();
b.a.show();
)
thank you for help
|
|
|
|
|
Hello,
In my datagrid, the TextColumn are set to:
aTextColumn.Alignment = HorizontalAlignment.Center;<br />
aTextColumn.Width = 140;<br />
aTextColumn.Format = "c";<br />
aTextColumn.FormatInfo = numberFormatInfo;
However, the first 5 rows, are appended and do not display dollar values, but they still display the dollar sign in front of all the values. Is there a way (like overriding the Paint method) of removing the dollar sign for the first 5 rows?
Thank you.
|
|
|
|
|
I have a datatable containing a date field which I have databound to a textbox on a form (the textbox is read only). Sometimes the date field is null, so in those cases I want to have the textbox (and it's associated label) disappear completely. I tried intecepting the Binding.Format event to example the value from the data source and set the visibily of the textbox control like this (tbValidTo is the textbox, lblValid is just a label):
<br />
private void tbValidTo_Format(object sender, ConvertEventArgs e)<br />
{<br />
if (e.Value == DBNull.Value)<br />
{<br />
if (tbValidTo.Visible)<br />
{<br />
tbValidTo.Visible = false;<br />
lblValid.Visible = false;<br />
}<br />
}<br />
else<br />
{<br />
if (!tbValidTo.Visible)<br />
{<br />
tbValidTo.Visible = true;<br />
lblValid.Visible = true;<br />
}<br />
DateTime dt = DateTime.Parse(e.Value.ToString());<br />
if (dt<DateTime.Now)<br />
{<br />
lblValid.ForeColor = Color.Red;<br />
}<br />
else<br />
{<br />
lblValid.ForeColor = SystemColors.WindowText;<br />
}<br />
e.Value = dt.ToString("MMMM d, yyyy");<br />
}<br />
}<br />
The problem is that this code is acting really weird. As you flick between records it sometimes fails to update the textbox and instead contains the old value. Sometimes it fails to reappear when flicking from a null date record to a record with a data. When I set a breakpoint at the begining of the event I can see that usually the event fires only once when you change records but sometimes it fires 3 times (it gets as far as setting the visibility and then suddenly refires) and other times it doesn't fire at all. Can anybody suggest what the problem here might be? I have another double field that also get's hidden and it works fine so long as the date field is disabled, otherwise it does the same thing. Other fields (that don't get hidden but do get formatted) behave just fine.
|
|
|
|
|
I have a class called tasks and right now it uses compareto to sort by duedate when it is in an arraylist, that is fine for right now, but I'm expanding to group by category. I now want to sort by category and then sort by duedate within the category sort. Is this possible? Here's my class:
<br />
public class Task: IComparable<br />
{<br />
private int _importance;<br />
public int Importance<br />
{<br />
get { return _importance; }<br />
set { _importance = value; }<br />
}<br />
<br />
private DateTime _DueDate;<br />
public DateTime DueDate<br />
{<br />
get { return _DueDate; }<br />
set { _DueDate = value; }<br />
}<br />
<br />
private string _subject;<br />
public string Subject<br />
{<br />
get { return _subject; }<br />
set { _subject = value; }<br />
}<br />
<br />
private string _entryID;<br />
public string EntryID<br />
{<br />
get { return _entryID; }<br />
set { _entryID = value; }<br />
}<br />
private string _category;<br />
public string Category<br />
{<br />
get { return _category; }<br />
set { _category = value; }<br />
}<br />
<br />
public int CompareTo(object other) <br />
{ <br />
return _DueDate.CompareTo(((Task)other)._DueDate); <br />
}<br />
<br />
}<br />
|
|
|
|
|
Try this:
public int CompareTo(object value)
{
Task compObj = (Task) value;
int result = _category.CompareTo(compObj._category);
if (result == 0)
result = _DueDate.CompareTo(compObj._DueDate);
return result;
}
www.troschuetz.de
|
|
|
|
|
my drop down boxes are not returning the correct choice when a user picks one. It still shows the old one. How can I get my code to see the new choice? In VC++ there was the UpdateData() function. Is there one similar to that in C#?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
ComboBox1.SelectedItem returns the current selection.
|
|
|
|
|
Can anyone offer any recommendations / tips for designing an 'options' dialog.
I just have a form with tabs for the the various categories, onChange events for the various form elements and I read / write my app.config file.
Seems a bit messy and ad-hoc, is there a a better way ?
|
|
|
|
|
Hello!!
I need to get the size of all images from an html page but i cant do one thing.
Whith this expression i get only images where heigth and width come in this order.
Ex:
<img src="../home/images/topo_01.gif" height="107" width="213">
<img src="../home/images/topo_01.gif" width="213" height="107">
i can make only one to work.
How do i do this?
r = new Regex("<\\s*img.*height=\"(?<heigth>.*?)\".*width=\"(?<width>.*?)\".*>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
thanks!!
Bruno Conde
pharaoh
|
|
|
|
|
r = new Regex(@"<img.+(height="?(?<height>[^"]+)"?\s+width="?(?<width>[^"]+)|width="?(?<width>[^"]+)"?\s+height="?(?<height>[^"]+)).*>")
This works fine for me
Remember you can put an "@"-sign in front of your string declaration, so you don't need to escape certain characters. This comes in very handy with regular expressions.
regards
-- modified 12-Sep-18 21:01pm.
|
|
|
|
|
I need a Cyclic Visual for a form I am developing. A cyclic is the control in a helicopter that the pilot usings to steer the aircraft. What I need is an overhead view of the position of the cylic. I.e. a circle with maybe a dot or something indicating its position. Any help would be much appreciated. Thanks
D
|
|
|
|
|
this is a really easy question....if i put a save file dialog on my form...how can i check if the user clciked the okay or cancel button...
|
|
|
|
|
hi there,
use DialogResult to achieve this.
for more detail, visit this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsdialogresultclasstopic.asp
<< >>
|
|
|
|
|
I've got a problem with latebind word in my app because I have to be independent from the installed office-version. With my first attemp to fill in the adresse-field of word-form it worked very efficent. I just referenced word, created a dot-file with some fields "Name, adress, zip and townname" in the form and coded oWordApp.ActiveDocument.FormFields.Item(ref cField1).Result = this.cmbAnrede.Text.Trim(); and so on. That works quiet well. But now, as I'm trying to do it latebound, to be independent of the office-version, this doesn't work anymore.
Can anybody hand me an ax to find my way out of the deep forrests?
regards
Klaus
|
|
|
|
|
It's generally best to bind to the lowest supported version of Word, and it will work on the newer versions of Word as well. So, if you support Word 2000 and Word XP, bind to Word 2000, and it will work for Word XP, too.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
John,
no I don't think so. That's why I tried to make it latebound <g>. In the beginning I coded it with Office97. It worked fine! Now the system is slowly turned to work with OfficeXP. The first workstation on which my routine was called, an error appeared.
I told the user "no prob. I'll compile it with OfficeXP. After a few minutes all works fine again, but from an other room they were yelling "Arrgh, my Computer is broken". You know, simple users are thinking of a ghost of/in the mashine<vbg>.
So, that's what my problem is. I'll have to make it kompatible with every thing.
thanks anyway
Klaus
|
|
|
|
|
Do you still need to support Office 97? If so, the worst case scenario would be to move this Word code into a dll, then intelligently choose which dll to load based on the Word version. This means a very small piece of code, with two (or more) versions of the same (recompiled) code, using different versions of Word.
John
|
|
|
|
|
is it advisable to port c# application to linux? If yes, how do you go abaout it? I heard of this thing called Mono? Does it work?
|
|
|
|
|
search this on CP site...
<< >>
|
|
|
|
|