16,016,489 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by EriBeh (Top 9 by date)
EriBeh
16-Sep-11 6:41am
View
Hello Mehdi,
I changed the service to a local user.
I didn't have access to the queue, changed the queues owner and the permissions now it works with the queue.
But when I try to access my mapped network-drive it says it does not find it, and when I use \\computer\directory it says wrong user or password.
I can open the target computer with windows explorer that works fine and does not ask for a username or password...
Any idea? Thanks a lot!
EriBeh
29-Jul-11 5:56am
View
Some additional info:
I can see my styled scrollbar in the textbox, the bindings are working.
But it is somehow wrong, it appears in the middle and is not scrolling.
So the error is in the Textbox style, somewhere at the "PART"... stuff,
I don't know how to use that exactly.
EriBeh
6-May-11 4:23am
View
I added LinQ namespace then it was okay, I have VS 2010.
But the solution does not work. The SubClasses have the same name and same values, but different namspace. So the SetValue does not work this way but gives an exception.
I mapped the target class manually, value after value. But it would be cool to find a solution how to do that dynamically ;-) Thanks for those suggestions and hints, I learned a lot.
EriBeh
5-May-11 4:31am
View
By the way, this only works for one subclass, not for subclasses with subclasses or structs, right?
EriBeh
5-May-11 2:38am
View
Hello yesotaso,
added your code like this:
void copyDict(object source, object target)
{
Dictionary<string, fieldinfo=""> fifsource = source.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public).ToDictionary(fi => fi.Name);
Dictionary<string, fieldinfo=""> fiftarget = target.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public).ToDictionary(fi => fi.Name);
foreach (KeyValuePair<string, fieldinfo=""> fi in fifsource)
{
if (fiftarget.ContainsKey(fi.Key) && fiftarget[fi.Key].FieldType == fi.Value.FieldType)
fiftarget[fi.Key].SetValue(target, fi.Value.GetValue(source));
}
}
Whas it thought this way? I get an error:
Error 65 'System.Array' does not contain a definition for 'ToDictionary' and no extension method 'ToDictionary' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
Isn't there a soultion to get my last posted code working? I just need to get the value to the right place there... thanks :-)
EriBeh
4-May-11 12:03pm
View
Please believe me, I need to copy everything from Class A to Class B when the sub-item exists in Class B. This is my job right now. It is not my decision. And I have no influence on Class A.
And I believe it can be done this way. I added new code, using Ref now which seems to be much better, I only have problems setting the values I found...
EriBeh
4-May-11 8:53am
View
Thanks for that suggestion.
My problem is I cannot do anything with the source (Class A).
It is updated somewhere else from time to time.
Then I change my target class and update a webservice based on my target class.
I have no influence on source (Class A).
I just need to copy everything from source to target, if it exists in target.
Source has structs and lists of structs. The structs contain strings and int and sometimes new stuff is added...
EriBeh
4-May-11 8:39am
View
This is hard to explain.
The source is a class that comes from somewhere else.
From time to time there are strings or structs added to the source.
Then I will add them to my target.
And I don't want to copy each single Class/Struct/string in one line, I would get around 300 lines then.
So I need to copy everything from source (if it is also existing in target) to target.
EriBeh
4-May-11 7:57am
View
Sorry, this is not possible here.
The types can be different, there maybe new types.
Both classes have subclasses of different own made type, Structs with ints and strings.
So I think my idea is 100% good. I just need to work out how to get the real sub-object instead of the class implementation into the copy function?
I don't know which types the classes may contain in future.
But thanks for the suggestion.
Show More