|
Used to do it similar to what you mentioned, except I did not use XXChanged to repopulate back to the business object. It was messy.
Now I mainly use DataBinding. The controls are unbound before the save, then I just clear the controls according to the control type. At least the code is cleaner and more uniform now.
|
|
|
|
|
I need to create a VB.NET service to exchange files with an a PDA using Telnet protocl. The PDA sends/receives files from an AS/400, a Unix box and a Microsoft FTP server, but all of the "chat" examples I've found can not be used. I have the C code from the Unix application and I'd like to create methods in C++ that I can call from my VB.NET project.
Can anyone send me any examples?
TIA!
Mike
Greetings from Kalamazoo, MI
|
|
|
|
|
There are articles around here showing how to call C++ methods in VB.NET, you'll have to do a search on that
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Try Using a COM Object to Wrap around your C++ methods and libraries. so you can adapt it to other systems
JO
|
|
|
|
|
Hello,
I've a C function that take function ptr in argument:
double CFunc(
double (*funcptrA)(char *),
double (*funcptrB)(char *),
double (*funcptrC)(char *)
);
And I would like to transform it in a cool object design.
I've tried a lot of solutions (functor, interface) but the only way my compilator agree is to declare argument functions (funcptrABC) as static.
To illustrate, Here 's what i wrote first:
#include CFunc.h
class CplusFunc{
virtual double A(char*);
virtual double B(char*);
virtual double C(char*);
double CplusExec(){
retrun Cfunc(&A,&B,&C);
}
};
It doesn't work but give the semantic i would like to give to my object.
Have you got an idea?
|
|
|
|
|
mp3butcher wrote: but the only way my compilator agree
mp3butcher wrote: Have you got an idea?
Well if you are using VC++ 2008 there is the newly added support for TR1 including Polymorphic Function Objects[^]
led mike
|
|
|
|
|
I wrote portables applications for windows linux & mac then I search a portable technic that avoid the use of a microsoft specific one...But thanks for the idea
|
|
|
|
|
mp3butcher wrote: that avoid the use of a microsoft specific one
I don't know why I am bothering with this since you obviously don't actually READ the links I give you but TR1 is from the ISO C++ committee[^] and was published in 2005. So there might be any number of compilers that currently support some of it.
led mike
|
|
|
|
|
|
|
Excuse me for my fast answer, but I've seen this syntax in boost but I don't understand how to make it work:
MSVC2008 Compiler tells that member pointer functions,pointer function and boost::function haven't the same signature...
So, I can't pass to my c function otherthing than a static (member) pointer function
Can you, please, explain me further?
|
|
|
|
|
mp3butcher wrote: MSVC2008 Compiler tells that member pointer functions,pointer function and boost::function haven't the same signature
Well I don't know what you did since you posted no code. What I do know is that I successfully reproduced the concepts discussed in that article I linked to using MSVC2008
Also I am now confused as to what you are attempting to do. You originally seemed to be asking about design but in this last post you say:
mp3butcher wrote: So, I can't pass to my c function otherthing than a static (member) pointer function
Your C function is what it is. If you are asking what you can use to match the parameters of that function that's not even a design question.
If you are asking about design, I suggest you look at using interfaces rather than function pointers or functors or any of those new mechanisms.
"All other things being equal, the simplest solution is the best."
|
|
|
|
|
In fact my question has two linked aspects:
As I can't pass otherthing than a static member function to my cfunction( double (*g)(char*)):
1)I would like to know how I could make it a real parameter (not hardcoded) that belong to the caller of Cfunc.
2)I would like to know how I could make a cool cpp design permitting to overload the argument pointer function.
Then the design side of my question is the second aspect.
First I would like to parametrize my cfunction with member function belonging to the caller object...
If you see a manner to do it passing other thing that a static member function, I would be very glad.
PS: I think what i've done with the function<> template is not what you're thinking of:
class CPP{
double funcparam(char*);
void exec(){
function2<double> f=&CPP::funcparam;
CFUNC(f);
}
};
Silly isn't it?:(For this I think I haven't understand what to do...
the only way I've found to make it work is:
class CPP{
static double funcparam(char*);
void exec(){
CFUNC(&funcparam);
}
};
but it don't permit to overload funcparam...
|
|
|
|
|
mp3butcher wrote: First I would like to parametrize my cfunction with member function belonging to the caller object...
If you see a manner to do it passing other thing that a static member function, I would be very glad.
See the C++ FAQ[^]
mp3butcher wrote: 1)I would like to know how I could make it a real parameter (not hardcoded) that belong to the caller of Cfunc.
I'm not sure what that means but it might be an interface.
Learning Object Oriented Design cannot be done by asking questions and getting answers. You have to become a Student and study the subject by reading some of the mountains of information that is available on the subject. I strongly suggest that you do just that. One obvious place to start might be to read about Design Patterns[^].
led mike
|
|
|
|
|
I'm using c++ for years..I'm already student. I've read a lot of things on pointer function (including the FAQ) and i'm not so good in the design pattern and a newbie with boost::function.
So unstead of say RTFM and tell on me, I would prefer you tell me how a function<> can help me in my problem as i can't pass it to my cfunc...
|
|
|
|
|
mp3butcher wrote: I would prefer you tell me how a function<> can help me in my problem as i can't pass it to my cfunc...
That's like asking how to make gold from straw. If you are asking about an alternative design for function pointers then there are several options like interfaces, functors and the function<>, but you would start by changing CFunc. These are alternatives to using function pointers they are not function pointers and therefore cannot be used as parameters that are defined to be function pointers. Get it?
led mike
|
|
|
|
|
OK that's all I would like to know...Thank you.
I can't keep the cfunc as it is... Damned C!
|
|
|
|
|
Hi Guys, I have developed this application and now realized that it is going to cost me alot of memory. Could you please suggest me some ideas based on your expereince. So here is the scenario.
1. I am reading and loading alot of images and text from an one xml file about 500 images.
2. Loading each images as an item in a listbox (so user can scroll down and can see all the images)
3. If user select any of the items from the listbox i display that item and stuff related to that item (like text, images)
Problem:
Since I am loading an entire xml file in memory and on the top I am making all the listbox item that consume alot of memory. Currently what i am thinking is that I should make each listbox item as thumbnail and load in listbox simply, so this way will save some processing time like reading and geneating each item. I am not 100% sure though.
I am lookign your help.
Thanks
|
|
|
|
|
You might want to take a look at using Virtualization on a ListView. There's a virtualization mode on the listview, which you may want to look into. To use this, you set VirtualMode = true; and VirtualListSize to some sensible amount. Then you hook up to the RetrieveVirtualItem event to load the next set of data in when you need it.
|
|
|
|
|
I would suggest reading up on the Proxy pattern and Flyweight pattern:
Absolutely cache each thumbnail...only display/render those which are inside the controls viewport. No point in render 500 image thumbnails if only 30 are displayed at a time.
I'm finding the only constant in software development is change it self.
|
|
|
|
|
Thanks for answering I got read about those proxy and flyweight pattern but meanwhile Some people are suggesting me to use Listview in it's virtual mode so only items being displayed inside the listview will be rendered.
So far i read about listview but i couldn't find that's acutally saying listview in virutal mode display render currently visible items.
|
|
|
|
|
|
Father class in how to use the special sub-category of type (such as sub-class form on a table on the TableAdapter), the father of the current thinking is kind of like adding traversal of all the things (such as traversing the form of succession All controls), the need to find, it will need to transform the type to use it. But now they can not find this object into the type of need. Thanks a lot.
Code is as follows:
/ / Father traverse sub-class category on the form for the control and use it
private void findcontrol (Control.ControlCollection controls)
(
foreach (Control ctrl in controls) / / This traversal of a similar type of controls or components
(
if (ctrl.GetType (). Name == "customers TableAdapter") / / form on a table, the TableAdapter
(
/ / Ctrl-type into the TableAdapter customers to use
/ / Cases, TableAdapter.Update (customers DataTable);
/ / Ctrl like to, as with customers TableAdapter
)
findcontrol (ctrl.Controls);
)
)
|
|
|
|
|
Hi,
I am working in an Internationalization project where I have to internationalize the phone numbers. The phone number entry would be in the following format.
<Country Code Dropdown based on ISO Standard based on which the country code would be populated> - <Area Code Textbox> - <Phone number Textbox> - <Extension Textbox> - <Phone Type Dropdown>
The phone type dropdown would contain Office Phone, Mobile Phone, Residence Phone among others. Based upon this we have to decide whether the area code exists. For ex, in India the mobile number is a complete 10 digit code(In near future it might also be 11 digits). In U.S mobile numbers has an area code. Alphanumerics can be used in U.S. In India, the area code might vary between 3-5 digits. The control should take care of all these based on the culture selected. The phone number should be stored with proper formatting(1-800-453-376-9876 in U.S, 91-9880098800 in India). The logic should take care of all these formattings. How could this be achieved?
The point to be noted is this should be done client side. We need to do only the formatting and not the validation. We are planning to use an XML file which would store all the formatting details of the countries based on which the controls can be rendered. We are also planning to build a WebcustomControl to build this so that it could be used while entry and display. Thanks for your time in reading this. Any replies appreciated. Once again thanks again.
|
|
|
|
|
k_dasaprakash wrote: 1-800-453-376-9876 in U.S
Just so you know, that is not a valid format for US phone numbers. It is something like 1-800-123-4567
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|