C# Help

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: C# Help

Re: C# Help

by gburk » Sat Jan 25, 2020 9:31 pm

Art

I think the major difference is i setup the form and compiled with C++/CLR and i haven't seen alot of info on CLR but i think it somewhat different in the way it passes functions between classes than in C++ 
I will keep searching..

Gary

Re: C# Help

by ArtF » Fri Jan 24, 2020 1:06 pm

Gary:

  It does sound like your using C# you know, in the raw C++ settings, you have to design a dialog to use, not a form.
In C# use, you usually design a  form and attach events and such to it. I suspect that's where you are.

So you have a form.h and a form.cpp , together they all simply called a class.
Inside form.h you likely have some declaration of the class itself..

in C++ ( C# may differ in some syntax), youd have something like..

class CMyForm : public CDialog
{
  int myvariable;
  bool mybool;
  void  MyButtonWasPressed();
}

  So form.h can be thought of as a declaration file, it tells the system what functions or variables
the class form contains. The Form.cpp contains the actual use of those items and the code itself
for the functions. So in it we find..

void MyButonWasPressed()
{
  //you want to acces your other class here, right?
}

So to have you button press call your other class you need to have
your form own one of those classes.. So you change form.h to this..

#include "class1.h"

class CMyForm : public CDialog
{
  class1 MyClass1;
  int myvariable;
  bool mybool;
  void  MyButtonWasPressed();
}

  And finally , change the form.cpp function to ..

void MyButonWasPressed()
{
  MyClass1.NameofFuntionHere();
}

  Now, thats how you do it ( in one way anyway ) in C++. I dont use C#
enough to remember the syntax, the system fills in most of it as you go.
So the above has to be done in the way C# does it. So you may want to explore
some googled example code , theres quite a bit out there of every sort. Im
self taught as a programmer, so most of my education was gleaned from
taking apart others code and climbing on their shoulders. Its a frustrating,
maddening, disheartening and addictive process to go through, but the
most enjoyable skill in the world to have.

Art

Re: C# Help

by gburk » Thu Jan 23, 2020 11:42 pm

Art

run into my first major brick wall..

Seems classes and function are handled a lot different in c++.

I have a form.h and form.cpp, so i created another class, called class1 it also has a class1.h and a class1.cpp.

my problem is i can't seem to figure out how to call the function in class1 form a button click in the form.h button click event. anything i have tried doesn't work..
looks like a whole new ball game form i have it my forms created in c .

any thoughts, or pointers as where to lookup the info.

Gary

Re: C# Help

by tweakie » Thu Jan 23, 2020 12:29 pm

ArtF wrote:
while( !Rested ) sheep++;
;D ;D ;D

Tweakie.

Re: C# Help

by ArtF » Thu Jan 23, 2020 1:16 am

Gary:

Its a long learning experience. Ive been using Visual Studio since it was released,
theres a lot to know about it, but youve started that path. Takes the first step to
get anywhere.. :)

Art

Re: C# Help

by gburk » Thu Jan 23, 2020 12:36 am

Art

Don't know if it was worth it but i figured out how to create forms in visual studio C++
and use the form designer with C++..

so i assume i will have to modify my search code function, and all the strings now, but haven't got that far yet..

Gary 

Re: C# Help

by gburk » Mon Jan 20, 2020 5:45 pm

The only time i did any coding was way back, can't even remember the years the old 6800 processor on the mac and Atari, i had the Atari TT, did all the work in assembly. was a a lot younger in those days and thing came easier.. wrote my own bulletin board, of course that was before internet and we all had dial ups modems. it was fun though.

Now just messing with it again mostly to kill some time..

Gary   

Re: C# Help

by Mooselake » Mon Jan 20, 2020 5:22 pm

Cobol may have been the only language where you needed a forklift to carry all the boxes of cards :)  Back in the early 70s I wrote a large fortran program (still have a listing in the attic)  to convert an interpreted report language to cobol that turned 12 hours of CPU time into 10 minutes on a Univac 1108, how fast the operators could change tapes became the limiting factor.  Being the smart assed kid I mentioned it to the cobol programmers, being much more tactful adults they just smiled.  That was the same company where I was in the same department as the APT post processor programmers, and a concrete block wall away from the CNC machines they wouldn't let me near.  Also the same place where I worked with the later founder of Autodesk, one of the best programmers I've ever met.

I wanted to find a Burroughs machine to play with algol on, but that wasn't to be.

Missed Ada except in articles, although PL/1 was around my second programming language after Fortran.  Had a class project to design a simple compiler (with a compiler generator tool, forget the name) in PL/1.  Never quite finished it but still got credit for the course.

Kirk

Re: C# Help

by ArtF » Mon Jan 20, 2020 4:25 pm



  Been at C++ for so long I think I dream in code.

while( !Rested ) sheep++;

Art

Re: C# Help

by BillM » Mon Jan 20, 2020 4:07 pm

Kirk

Cobol ?  That goes way back.  At one time there was talk about resurrecting a version to make an object oriented Cobol.

Remember Algol?  The old Data General minicomputer's operating system was written in Algol.  Another language that fizzled was the government's attempt to standardize programming for defense systems with a new language Ada.

C and C++ are still winners in my mind for high level compiled programming languages.

Bill Michael

Top