|
Within the expressions window enter the following:
ReportItems("textbox").Value
Or see this[^] web site.
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
I want to compare two objects of different versions and display there differences in UI.
First I call a method to know if there is any difference between the two objects
The method is as -
public bool AreEqual(object object1,object object2, Type comparisionType)
If the above method returns true
I call GetDifferences method to get the differences which is as -
public ObjectDifference[] GetObjectDifferences(object object1, object object2, Type comparisionType)
{
ArrayList memberList = new ArrayList();
ArrayList differences = new ArrayList();
memberList.AddRange(comparisionType.GetProperties());
memberList.AddRange(comparisionType.GetFields());
for (int loopCount = 0; loopCount < memberList.Count; loopCount++)
{
object objVal1 = null;
object objVal2 = null;
MemberInfo member = ((MemberInfo)memberList[loopCount]);
switch (((MemberInfo)memberList[loopCount]).MemberType)
{
case MemberTypes.Field:
objVal1 = object1 != null ?((FieldInfo)memberList[loopCount]).GetValue(object1):null;
objVal2 = object2 != null?((FieldInfo)memberList[loopCount]).GetValue(object2):null;
break;
case MemberTypes.Property:
// object temp = ((PropertyInfo)memberList[loopCount]).
objVal1 = object1!= null ?((PropertyInfo)memberList[loopCount]).GetValue(object1, null) :null;
objVal2 = object2 != null? ((PropertyInfo)memberList[loopCount]).GetValue(object2, null):null;
break;
default:
break;
}
if (AreValuesDifferentForNull(objVal1, objVal2))
{
ObjectDifference obj = new ObjectDifference(objVal1, objVal2, member,member.Name);
differences.Add(obj);
}
else if (AreValuesDifferentForPrimitives(objVal1, objVal2))
{
ObjectDifference obj = new ObjectDifference(objVal1, objVal2, member, member.Name);
differences.Add(obj);
}
else if (AreValuesDifferentForList(objVal1, objVal2))
{
ObjectDifference[] listDifference = GetListDifferences((ICollection)objVal1, (ICollection)objVal2,member);
differences.AddRange(listDifference);
}
else if ((!AreValuesEqual(objVal1, objVal2)) &&( objVal1 != null || objVal2 != null))
{
ObjectDifference obj = new ObjectDifference(objVal1, objVal2, member, member.Name);
differences.Add(obj);
}
}
return (ObjectDifference[])differences.ToArray(typeof(ObjectDifference));
}
public class ObjectDifference
{
private readonly object objectValue1;
private readonly object objectValue2;
private readonly System.Reflection.MemberInfo member;
private readonly string description;
public object ObjectValue1 {
get { return objectValue1; }
}
public object ObjectValue2 {
get { return objectValue2; }
}
public System.Reflection.MemberInfo Member {
get { return member; }
}
public string Description {
get { return description; }
}
public ObjectDifference(object objVal1,object objVal2,System.Reflection.MemberInfo member,string description)
{
this.objectValue1 = objVal1;
this.objectValue2 = objVal2;
this.member = member;
this.description = description;
}
For each difference I create an object of type ObjectDifference and add it to the array. The highlighted portion is the one where I am stuck! If the object contains another complex object, My program does give me the differences but I dont know which type it belonged to
For example I have two objects of type Name
class Name{
string firstName;
string LastName;
List<phonenumber> phNumber;
}
class PhoneNumber{
string officeNo;
string MobileNo;
string HomeNo;
}
while comparing two objects the output I get is plain -
firstname - John Mary
LastName- cooper Lor
officeNo - 22222 44444
MobileNo - 989898 089089
HomeNo-- 4242 43535
The Hierarchy that officeNo is of type PhoneNumber is lost. which is important for me to display
How should I maintain this type of tree while creating differences.
Hope I am able to make my problem understood.
|
|
|
|
|
Hi,
A DLL is reffered in a windows application, the dll contain a form. When i call the dll the form is opened. When i close the Form in the dll, i need to pass a value back to the windows application to identify the dll is closed. How can i get the notification?
Thankyou,
YPKI
|
|
|
|
|
There is an event called "Closed". You can hear of that event.
MyForm myForm = new MyForm();<br />
myForm.Closed += new EventHandler(myForm_Closed);<br />
myForm.ShowDialog();<br />
<br />
...<br />
private void myForm_Closed(object sender, EventArgs e)<br />
{<br />
}
|
|
|
|
|
Hi all
I know its stupid but no way out.
lets say
I have 2 forms. activity is...1 form hide another open...vice versa
I have some restriction here. i cant use any button to exit.
I just have only way to click the cross on the top right side of forms.
By clicking cross it will exit all forms.
But now in my program its not working because another form is hidden.
I have to stop it manualy.
Any suggetion pls
Thanks
|
|
|
|
|
On Form_ClosingEvent just write Application.Exit();
This will exit the whole application
|
|
|
|
|
should I mention anything in form.Designer.cs file for handler?
|
|
|
|
|
Just select the form ...
SElect the properties, and go for events...
In events list you may find Form_Closing or Form_Closed event..
Take any one as per your requirement..
Double click there the event will be generated in your class file. .
|
|
|
|
|
Thanks a bunch friend...
i have learned many things by this.
|
|
|
|
|
|
I am using Environment.OSVersion for geting the Operation system version. My application is running on Microsoft Windows XP Professional Service pack 2.
when i try to retrieve the os version see the code snippet:
log.Info("ASET OSVersion=" + Environment.OSVersion);
i am getting the following output:
2009-03-12 14:18:40,483 [INFO ] [3528] - ASET OSVersion=Microsoft Windows NT 5.1.2600 Service Pack 2
The output should be Micorsoft windows xp , but here it is giving some thing else.
Can any one help me in this regard?
|
|
|
|
|
AFAIK XP is recognized as NT platform only. I don't remember it exactly but I think it the OS is determined by 'Environment.OSVersion.version.Minor'. I think if the minor value is 3 it is XP. (I'm not sure...try google)
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
You need to extract the product name from Environment.OSVersion.Version.Minor property. If it is 1 then it is XP. All the codes can be found here[^].
IMO to know if it is XP professional or home, you will need to use GetVersionEx by P/Invoking win32 api.
|
|
|
|
|
can anybody gives me some case in ASP.net about how to creat a comment system that real-time displays what client just post.
this kind of comment system seems poplar.
thanks.
|
|
|
|
|
peacefulheart wrote: poplar
Why do you want a comment system involving trees?
peacefulheart wrote: ASP.net
We have an ASP.Net forum. Use it; you'll fit in much better and feel so much cleverer
|
|
|
|
|
Hello,
In my project there is one requirement related to groove, we want to import files in Issue Tracking tool in Groove programmatically using dot net or with any technology.
I have downloaded Groove Web Services Development Kit from below link.
http://www.groove.net/solutions/develop/downloads.cfm and I have seen that there is no API available for importing a file in Issue Tracking tool.
(Even I have checked on Microsoft site also for available Web Services http://msdn.microsoft.com/en-us/library/bb290979.aspx )
So will it be possible to develop application which can import files in Issue Tracking Tool of Groove?
If you have API for it then could you please provide it to me? Or if there is any other way then also please revert.
Thanks!
Regards,
Vibhuti Patel
|
|
|
|
|
Hi,
I have 2 forms. Form1 contains a DataGridView and Form2 contains the textboxes and dropdownlists etc.
I need to click on a record on form1 to display that record in form2. I have created a property and if I run the app the property gets set but when it moveds to form2 the property is set to 0. What am I missing?
Here is my code on form1 (This form contain the datagridview):
private int _employeeId;
public int EmployeeID
{
get { return _employeeId; }
set { _employeeId = value; }
}
EmployeeID = int.Parse(this.dsWBGTS.Person[1].LocalId.ToString());
this.personTableAdapter.FillByLocalId(this.dsWBGTS.Person, EmployeeID);
Here is my code for Form2 (This form need to display the record selected in form in):
frmDashboard = new Dashboard();
dashboardForm.personTableAdapter.FillByLocalId(this.dsWBGTS.Person, dashboardForm.EmployeeID);
Illegal Operation
|
|
|
|
|
Hi,
I need some help for implementing single-sign-on in an asp.net web application.
Currently, we have a login page. Username is 1st checked in SQL Server 2005 database, after that credentials are checked in LDAP.
If authenticated, then User is allowed to enter the Main Page.
Now, we need to implement single-sign-on i.e. once the User provides the link of the application, internally User's windows login credentials should be checked against LDAP and authenticate the User.
There should not be any login page.
I an able to get the Windows login Username and IsAuthenticated value, but not the password.
Has anyone implemented this?
Can anyone share the code for my reference.
|
|
|
|
|
Siffon wrote: Username is 1st checked in SQL Server 2005 database, after that credentials are checked in LDAP.
So you are authenticate user twice. Why?
Siffon wrote:
Now, we need to implement single-sign-on i.e. once the User provides the link of the application, internally User's windows login credentials should be checked against LDAP and authenticate the User.
There should not be any login page.
Windows credentials always check with your AD only.
Siffon wrote: I an able to get the Windows login Username and IsAuthenticated value, but not the password.
No, You can't read password from Active Directory. Only can authenticate.
As, this is a web application, you can control it from bowser itself.
Tools -> Internet Option -> Security Tab -> Click on Custom Level -> Settings [ Scroll to User Authentication Section ], select Automatically login with current user name and password.
It will take the current user credentials and will login to your application when then hit the url.
But why? If some one else want to login from other system what will happen ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Dear All,
I have an application which connects to remote machine. I want to check the behavior of this application when remote machine is suddenly restarted. For this purpose, i have to physically access remote machine and restart it. After that i check how my application behaves.
By restarting the remote machine, i am actually making that remote machine inaccessible. Now i want to do it programatically so that i don't need to physically connect to remote machine to restart it.
How can i make a "remote" machine inaccessible from my local box for a certain time ? I want to do it programatically. By making remote machine "inaccessible" doesn't necessarily mean that i restart it. What i want to do is to just temporarily make it inaccessible from my local box.
Imtiaz
|
|
|
|
|
how can i cheack listViewItems by item.Text.....????
foreach(string path in dlg.fileNames)
{
if (listView1.Items.Find(path, fales) == null )
{
my method.......
}
}
A S E L A
|
|
|
|
|
ListView.FindItemWithText()
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Lol, what a perfect method name!
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I'm trying to write a windows mobile program that shows data in a grid. I'm using the DataGrid control to display the data. I want to change 1 cell and make the font larger and bold.
How do I do this?
|
|
|
|
|
i'd like to get my code executed from case 1 to case 3, but i got this error . Here are my codes :
int State = 1
switch (State)
{
case 1:
a=1;
a++;
State++;
case 2:
State++;
case 3:
a=0;
}
Thanks
|
|
|
|