sticky
Welcome and Getting Started with F#

All replies

  • Professional F# 2.0 has gotten great reviews from everyone who has taken the time to read it.  It seems to appeal especially to those coming from a strong Object Oriented background. 

    http://www.amazon.com/Professional-F-2-0-Ted-Neward/dp/047052801X

    Thursday, June 30, 2011 4:00 PM
  • Thanks Rick, added it to the list.
    Thursday, June 30, 2011 10:20 PM
    Owner
  • Here, http://a6systems.com/fsharpcheatsheet.pdf , you can get a good cheatsheet ;-)
    Friday, July 01, 2011 1:01 PM
  • The Community for F# is a monthly Live Meeting focusing on various uses of F#. The recordings are posted after the meetings and hosted on http://fpish.net/, which is another useful resource for F# developers.
    Ryan Riley @panesofglass
    Sunday, September 11, 2011 10:25 PM
  • Hello:

    It's called Visual F #.
    Why does not Microsoft make a Windows form with the F # language?

    https://www.youtube.com/watch?v=3PlRyug05hM



    Greetings.


    http://electronica-pic.blogspot.com

    Thursday, May 03, 2018 8:34 AM
  • Hello:

    I want to make a program with Visual F # with Windows Form. It is about opening and closing the reader tray. Crack a Windwos form with two buttons.


    The code below is done in F # console mode and it works.

    Console Code F #:

    open System
    open System.Runtime.InteropServices
    open System.Text;
    
    // importar librería o dll externo.
    [<DllImport("winmm.dll")>]
    extern int mciSendString(string lpstrCommand, StringBuilder lpstrReturnString,
            int uReturnLength, IntPtr hwndCallback)
    
    let rt = StringBuilder(127)
    
    // Evento.
    let DoEvents (transition:string) =
        Console.SetCursorPosition(0, 6)
        Console.Write transition
    
        
    //let action state transition (mensaje:string) = 
    //    Console.SetCursorPosition(0, 6);
    //    DoEvents transition;
    //    mciSendString(state, rt, 127, IntPtr.Zero) |> ignore
    //    Console.SetCursorPosition(0, 6)
    //    Console.Write("           ")
    //    Console.SetCursorPosition(0, 6)
    //    Console.Write(mensaje)
    // Código de abajo más simplificado.
    
    let action state transition (mensaje:string) = 
        let reset (text : string) = 
            Console.SetCursorPosition(0, 6)
            Console.Write text
        reset transition
        mciSendString(state, rt, 127, IntPtr.Zero) |> ignore
        reset "           " // Reemplace esto y la siguiente línea con solo 
        reset mensaje       // escribir más borrar como `reset (mensaje +" ")`.
        
    // Pulse letra A para abrir bandeja o C para cerrar bandeja.
    let rec loop() =
        match Console.ReadKey(true).Key with
        | ConsoleKey.Escape -> ()
        | ConsoleKey.A -> action "set CDAudio door open" "Abriendo..." "Abierto."
                          loop()
        | ConsoleKey.C -> action "set CDAudio door closed" "Cerrando..." "Cerrado."
                          loop()
        | _ -> loop()
    
    [<EntryPoint>]
    let main argv = 
        // Título de la ventana.
        Console.Title <- "Visual F# 2017"
    
        // Tamaño ventana consola.
        Console.WindowWidth <- 29 // X. Ancho.
        Console.WindowHeight <- 8 // Y. Alto.
    
        // Cursor invisible.
        Console.CursorVisible <- false
    
        // Posición del mansaje en la ventana.
        Console.SetCursorPosition(0, 0)
        Console.Write(@"Control bandeja del lector:
    
    A - Abrir bandeja.
    C - Cerrar bandeja.
    ===========================")
        loop()
        0 // Devolver un código de salida entero.
    

    I followed an example of creating in this code per ome muetsra the window of the console and the Form at the same time.

    // https://www.youtube.com/watch?v=3PlRyug05hM
    
    open System
    open System.Windows.Forms
    
    let form = new Form()
    form.Visible <- true
    form.Text <- "Form F#"
    
    let label = new Label()
    label.Text <- "Label F#"
    
    form.Controls.Add(label)
    
    [<STAThread>]
    Application.Run(form)

    With the Visual C # language it works very well. I want to adapt it to Visual F #.

    Visual Example C #:

    Code C#:

    using System;
    using System.Runtime.InteropServices; // No olvidar.
    using System.Text;
    using System.Windows.Forms;
    
    namespace Bandeja_cs
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            [DllImport("winmm.dll")]
            public static extern Int32 mciSendString(string lpstrCommand, StringBuilder lpstrReturnString,
        int uReturnLength, IntPtr hwndCallback);
    
            StringBuilder rt = new StringBuilder(127);
    
            private void button_Abrir_Click(object sender, EventArgs e)
            {
                label_Mensaje.Text = "Abriendo...";
                Application.DoEvents();
                mciSendString("set CDAudio door open", rt, 127, IntPtr.Zero);
    
                /* Si quieres por ejemplo elegir la unidad que quieras, en este caso la H, se le asigana !H
                   como indica abajo. En vez de CDAudio, CDAudio!H.
                   mciSendString("set CDAudio!H door open", rt, 127, IntPtr.Zero);
                */
    
                label_Mensaje.Text = "Abierto.";
            }
    
            private void button_Cerrar_Click(object sender, EventArgs e)
            {
                label_Mensaje.Text = "Cerrando...";
                Application.DoEvents();
                mciSendString("set CDAudio door closed", rt, 127, IntPtr.Zero);
                label_Mensaje.Text = "Cerrado.";
            }
        }
    }
    What I want is to create a visual form with F # as it is done in C #. To be able to open and close the disk reader tray.

    How is it done?

    A cordial greeting.

    • Edited by Metaconta Thursday, May 03, 2018 9:12 AM
    Thursday, May 03, 2018 9:11 AM