Help Creating a dll

Discussion in 'Questions (Windows Mobile)' started by Cableguy, Jul 21, 2007.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi guys....

    I decided to have it a go...but stopped right in the 1st line of code...

    Im trying to create a custom control using Shap-Develop...

    So I create the graphical control and now must do the code...

    1st- what is the constructer syntax like?

    I have ..

    mycontrol obj = new mycontrol

    Is this correct?

    I2nd- Now I need to accept some args, 4 Strings and 1 Image name, how do I implement this?

    Thanks guys....
     
  2. Cableguy

    Cableguy Expert Licensed User

    After beeing stuck for most of the afternoon, i decided to re-install vs2005 and try in it to build my dll....

    As before designing the control grafic is easy but the rest...

    HELP!!!

    OK, putting it simple....

    I'm trying to build a 4 Label, 1 image user control, wich args will only be the text for the labels and the image file name, all other props are locked....

    please help...I don't want anyone doing it for me, I want to understand what i'm doing....
     
  3. agraham

    agraham Expert Licensed User

    This may help. It is the simplest possible C# dll that displays and undisplays the wait cursor.

    Note that the constructor is a function with the same name as the class. This constructor is a do nothing constructor as no initialisation is needed.

    Replace the existing constructor (or add another) such as

    Public myclassname(string s1, string s2, string s3, string s4, string image)
    {
    // do your initialisation
    }

    You can add as many constuctors as you want as long as their argument lists are different. The first constructor will be New1 in B4PPC, the next New2 and so on. For example

    Public myclassname(string s1, string s2, string s3, string image)
    {
    // do your initialisation including setting s4 to some default or null
    }
     

    Attached Files:

  4. Cableguy

    Cableguy Expert Licensed User

    Thanks agraham....

    Do i need to declare the args before the constructer? If so where?
     
  5. agraham

    agraham Expert Licensed User

    No. They ARE being delared in the constructor argument list, you merely need to use their values in your initialisation code or store them in private local variables before the constructor returns or they are lost.
     
  6. Cableguy

    Cableguy Expert Licensed User

    Ok, You are beeing very helpfull....

    Now the dumber question...

    Do i need to worry about the font setting in the control properties?

    And one last but perhaps the more inportant to me...
    I'm also ading a button to the control...(It's an About Panel) shhh.....how do I implement dispose with the button click event?
     
  7. agraham

    agraham Expert Licensed User

    If you are interested in coding for the .NET Framework and don't already know about Lutz Roeders' .NET Reflector then you should.

    http://www.aisto.com/roeder/dotnet/

    This superb utility lets you examine almost all of the .NET Framework in the language of your choice, VB.NET, C# Delphi etc. and see how Microsoft has coded it. You can also look inside the B4PPC dlls and other .NET exes to see how they are built and what they do. Download it and in case it is not obvious press the spacebar or invoke Tools -> Disassemble to see the code for the selected assembly. There are various add-ons, of variable quality, available via a link on the download page. I like FileGenerator which will produce a VS 2005 project file set, although actually getting it to compile without errors may be a battle!
     
  8. agraham

    agraham Expert Licensed User

    I don't know what control you are using but I would try it and see. I think most of the existing controls come with a default font already set.

    I'm not sure what you mean but normally in .NET code you don't need to ever implement a disposal function as the .NET Garbage Collector will remove an object when there are no further references to it. Disposal is normally only needed when your code has acquired resources from outside .NET (like mallocing memory or interacting with non-managed dlls) that need to be explicitly freed. Doing this is unsafe code that should be avoided if at all possible as you are then losing the safe coding advantages of the .NET Framwork.
     
  9. Cableguy

    Cableguy Expert Licensed User

    Calling the control will pop-up( eventaully) a Panel containing the refered fields and, beiing all of them just output fields, i need to implement a way of hidding/disposing the control...that's why I added the button, but how to implement the Hide or, preferably, the dispose upon button click?

    BTW-Thanks for the link, great tool...
     
  10. Cableguy

    Cableguy Expert Licensed User

    Ok, I'm/was getting confused with the amount of files created with the basic project, but i'm starting to get a hold of things...
    So I implemented 1 constructer and 1 method(?) called DLLVersion...Anad build the solution....

    I tryed it out and it works....well...sort of...my constructor is there and my method along with a LOT of other things that I dont know what they are, and that i didn't create....What am i doing wrong?
     
  11. Cableguy

    Cableguy Expert Licensed User

    I decided to take Hoffi aproach and try to add the necessary controls to my dllin "runtime"....

    my parameters will be:

    object.AoutPanel ( Top, Left, Caption, Title, Picture, text, copyright ) ...a bit long, but hey, they can be variable refers...

    I don't want to bind my custom control to a form or panel, so that when called it would be on front of whatever form or panel is visible...

    How do I code that in the dll?
    How to set private parameters to the controls i use in the dll, like position relative to a panel( private dll control )?

    I think now I've managed a few more things about dll creation...
     
  12. dzt

    dzt Active Member Licensed User

    Hi Cableguy,

    As I can see, your are not making a custom control but a custom form. You need a form to display various controls on it.
    The form can be part of your library.

    Take a look at my code
    Code:
    [B][SIZE=2][COLOR=#008000][B][SIZE=2][COLOR=#008000]namespace [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]AboutBox [/COLOR][/SIZE][/COLOR][/SIZE][/B]
    [SIZE=
    2][COLOR=#008000][B][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]class [/COLOR][/SIZE][SIZE=2][COLOR=#000000]AboutBox:IDisposable [/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#0000ff]private [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]System[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Windows[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Forms[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Form frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400]; [/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#008000]//Constructor[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#191970]AboutBox[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]Left[/COLOR][/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]Top[/COLOR][/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]Width[/COLOR][/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]Height[/COLOR][/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]string [/COLOR][/SIZE][SIZE=2][COLOR=#000000]lblText[/COLOR][/SIZE][SIZE=2][COLOR=#006400])[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]System[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Windows[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Forms[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Form[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE][/B]
     
    [B][SIZE=
    2][COLOR=#008000]//Sizebale form, not covering all the screen[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]FormBorderStyle [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#000000]System[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Windows[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Forms[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]FormBorderStyle[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]None[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
     
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Left [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#000000]Left[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Top [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#000000]Top[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Width [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#000000]Width[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Height [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#000000]Height[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
     
    [B][SIZE=
    2][COLOR=#008000]//Add a label to your AboutBox[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]System[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Windows[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Forms[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Label lbl1 [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]System[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Windows[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Forms[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Label[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]lbl1[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Text [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#000000]lblText[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]lbl1[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Left [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]50[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]lbl1[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Top [/COLOR][/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]60[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Controls[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Add[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][SIZE=2][COLOR=#000000]lbl1[/COLOR][/SIZE][SIZE=2][COLOR=#006400]);[/COLOR][/SIZE][/B]
     
    [B][SIZE=
    2][COLOR=#008000]//Add more Controls bellow[/COLOR][/SIZE][/B]
     
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
     
    [B][SIZE=
    2][COLOR=#008000]//Show and continue execution. Does not wait for the AboutBox to return[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Show[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Show[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
     
    [B][SIZE=
    2][COLOR=#008000]//Show and wait to finish like msgbox[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]ShowDialog[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]ShowDialog[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
     
     
    [B][B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]double [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]DLLVersion[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#8b4513]get [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2][COLOR=#000080]return [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]1[/COLOR][/SIZE][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Dispose[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#008080]try[/COLOR][/SIZE][/B][/B]
    [B][SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#000000]frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Dispose [/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
    [B][B][SIZE=
    2][COLOR=#008080]finally[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]{}[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE][/B]
    [/COLOR][/SIZE]
     
  13. Cableguy

    Cableguy Expert Licensed User

    Thanks dzt!!

    That was exactly what I needed!!!!

    Just one question....
    My form will have a button (OK) in order to close/dispose of the control, How do I implement the button click event in the dll????
     
  14. dzt

    dzt Active Member Licensed User

    See code bellow

    Code:
    [B][SIZE=2][COLOR=#008000]namespace [/COLOR][/SIZE][/B][SIZE=2]AboutBox [/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]class [/COLOR][/SIZE][SIZE=2]AboutBox:IDisposable [/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]private [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Form frmAbout[/SIZE][SIZE=2][COLOR=#006400]; [/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#008000]//Constructor[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#191970]AboutBox[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2]Left[/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2]Top[/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2]Width[/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][B][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2]Height[/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]string [/COLOR][/SIZE][SIZE=2]lblText[/SIZE][SIZE=2][COLOR=#006400])[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Form[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Sizebale form, not covering all the screen[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]FormBorderStyle [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]FormBorderStyle[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]None[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
     
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Left [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]Left[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Top [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]Top[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Width [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]Width[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Height [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]Height[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Add a label to your AboutBox[/COLOR][/SIZE]
    [SIZE=
    2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Label lbl1 [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Label[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
    [SIZE=
    2]lbl1[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Text [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]lblText[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]lbl1[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Left [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]50[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]lbl1[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Top [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]60[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Controls[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Add[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][SIZE=2]lbl1[/SIZE][SIZE=2][COLOR=#006400]);[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Add OK Button[/COLOR][/SIZE]
    [SIZE=
    2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Button btnOK [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Button[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
    [SIZE=
    2]btnOK[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Left [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]10[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]btnOK[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Top[/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]10[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]btnOK[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Text [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]"OK"[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Controls[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Add[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][SIZE=2]btnOK[/SIZE][SIZE=2][COLOR=#006400]);[/COLOR][/SIZE]
    [SIZE=
    2]btnOK[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Click [/SIZE][SIZE=2][COLOR=#006400]+= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]EventHandler[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][B][SIZE=2]this[/SIZE][/B][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]btnOK_Click[/SIZE][SIZE=2][COLOR=#006400]); [/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Add more Controls bellow[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
     
    [B][SIZE=
    2][COLOR=#0000ff]private [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]btnOK_Click[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Object sender[/SIZE][SIZE=2][COLOR=#006400], [/COLOR][/SIZE][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]EventArgs e[/SIZE][SIZE=2][COLOR=#006400]) [/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#008000]//Hide the form[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#008000]//Of course you can rise an event (visible to b4ppc program) and not hide the form here.[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#008000]//See ScrollBar sample[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Hide[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Show and continue execution. Does not wait for the AboutBox to return[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Show[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Show[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Show and wait to finish like msgbox[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]ShowDialog[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]ShowDialog[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
     
     
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]double [/COLOR][/SIZE][/B][SIZE=2]DLLVersion[/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#8b4513]get [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2][COLOR=#000080]return [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]1[/COLOR][/SIZE][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]void [/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Dispose[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#008080]try[/COLOR][/SIZE][/B]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Dispose [/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#008080]finally[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]{}[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
     
  15. Cableguy

    Cableguy Expert Licensed User

    Hi..Again..

    I've now learned a few things about dll creation and I am almost finished with my first dll...

    Still some issues remain...

    I had my contructor like this:

    public AboutPanel(string CaptionText, string TitleText,....,string Logo)

    Now I've changed it to just:

    public AboutPanel()

    In order to have the CaptionText as a public property...

    This is were I'm stuck..

    How to code the property...I've searched and searched and got even more confused...
    I hadded the individual control references as private statemenst, but no luck...

    PS: except for Logo, that is to be a reference to an image file (pic.image=Logo), all controls are labels and properties are Text.

    HELP!!!
     
  16. dzt

    dzt Active Member Licensed User

    I'm not sure I understand but here is an example code
    Code:
    [B][SIZE=2][COLOR=#0000ff]...[/COLOR][/SIZE][/B]
    [B][COLOR=
    #0000ff]...[/COLOR][/B]
    [B][SIZE=
    2][COLOR=#0000ff][B][SIZE=2][COLOR=#0000ff]private [/COLOR][/SIZE][/B][SIZE=2][COLOR=#000000]System[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Windows[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Forms[/COLOR][/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2][COLOR=#000000]Form frmAbout[/COLOR][/SIZE][SIZE=2][COLOR=#006400]; [/COLOR][/SIZE][/COLOR][/SIZE][/B]
    [B][SIZE=
    2][COLOR=#0000ff]private [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Label lbl1[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Constructor[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#191970]AboutBox[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]()[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Form[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#008000]//Sizebale form, not covering all the screen[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]FormBorderStyle [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]FormBorderStyle[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]None[/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
     
    [SIZE=
    2]lbl1 [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]new [/COLOR][/SIZE][/B][SIZE=2]System[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Windows[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Forms[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Label[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]();[/COLOR][/SIZE]
    [SIZE=
    2]lbl1[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Left [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]50[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]lbl1[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Top [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]60[/COLOR][/SIZE][SIZE=2][COLOR=#006400];[/COLOR][/SIZE]
    [SIZE=
    2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Controls[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][B][SIZE=2][COLOR=#191970]Add[/COLOR][/SIZE][/B][SIZE=2][COLOR=#006400]([/COLOR][/SIZE][SIZE=2]lbl1[/SIZE][SIZE=2][COLOR=#006400]);[/COLOR][/SIZE]
     
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
     
    [B][SIZE=
    2][COLOR=#0000ff]public [/COLOR][/SIZE][/B][SIZE=2][COLOR=#ff0000]string [/COLOR][/SIZE][SIZE=2]lbl1Text[/SIZE]
    [SIZE=
    2][COLOR=#006400]{[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#8b4513]get [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2][COLOR=#000080]return [/COLOR][/SIZE][SIZE=2]lbl1[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Text[/SIZE][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#8b4513]set [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2]lbl1[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Text [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2]value[/SIZE][/B][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE]
    [SIZE=
    2][COLOR=#006400]}[/COLOR][/SIZE]
    [B][SIZE=
    2][COLOR=#0000ff]...[/COLOR][/SIZE][/B]
    [B][COLOR=
    #0000ff]...[/COLOR][/B]
     
    Last edited: Aug 2, 2007
  17. agraham

    agraham Expert Licensed User

    It should be as simple as this :-

    Code:
    //the actual property
    Private string  CapText ;


    // the 
    public access to the property
    public string CaptionText 
    {
       get {
    return CapText;}
       set {CapText = value;}
    }
     
  18. Cableguy

    Cableguy Expert Licensed User

    Guys, I have a lot of respect for your knoleage, but something is wrong in your examples...neider work!!

    Agraham's, example aloews me to compile but no string is passed as a property to the label, dzt's example doesn't even alows me to compile, so I decided to zippit and let you guys take a peak at what I've got so far...

    PS: as I posted before it worked OK when I had the properties set on the contructor...but it was not what i was aiming for as a pratical dll....

    THANKS GUYS, FOR ALL YOUR EFFORT IN HELPING ME, AND SORRY TO BE SUCH A PAIN....
     

    Attached Files:

  19. dzt

    dzt Active Member Licensed User

    I attach your AboutPanel source (with both solutions completed, mine and agraham's) and a b4ppc test program.

    I hope that will help you be less confused.

    PS

    No pain at all. Noone is obligated to answer or help. It is a "COMMUNITY" matter helping each other.
    And has lot of fun!!!
    :)
     

    Attached Files:

  20. agraham

    agraham Expert Licensed User

    Damn! Well done dzt, beat me by 10 minutes.
     
Loading...