Custom Form – Dynamics NAV

Hey Friends,

As we all know we have certain limitations while designing a Page in NAV, i.e. We deliberately cant design our NAV Page as we want to, Actions OR Buttons must be on the Top, We cant make buttons somewhere on the middle of the Page, We can’t design a page in which we can have multiple controls like Buttons, Radio Buttons and so on and possibly anywhere on the Page.

This limitation could be sorted out if we have certain hands on, on Dot Net variables. I just got a requirement where client was asking for certain design on the Page as per his requirement and he hardly cares for the limitations. So I just make a custom Windows Form which anyhow fulfilled his requirement.

You have the liberty to add n number of buttons or other controls or how badly you want to customise it.

//RWN
WinForm := WinForm.Form;
Colour := Colour.Color;
WinText := WinText.TextBox;
WinForm.MaximizeBox(FALSE);
WinForm.Width := 733;
WinForm.Height := 415;
WinForm.ActiveForm;
WinForm.BackColor := Colour.Green;
WinForm.ForeColor := Colour.Green;
WinForm.BackgroundImageLayout(Layout.Center);
WinForm.FormBorderStyle(FormBorderStyle.SizableToolWindow);
WinForm.Text := ‘SMS BODY’;
WinForm.StartPosition := StartPosition.Manual;
WinText.BackColor(Colour.LightBlue);
WinText.Font(Font.Font(‘Algerian’,12));
WinText.Width(733);
WinText.Height(415);
WinText.Multiline(TRUE);
WinForm.Controls.Add(WinText);
WinForm.ShowDialog;
//RWN

 
WinForm         DotNet       System.Windows.Forms.Form.’System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

 
WinText          DotNet        System.Windows.Forms.TextBox.’System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

 
Colour            DotNet          System.Drawing.Color.’System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’

Advertisements

Off The Topic – Shutdown Machine from NAV

Hey Friends,

This Post is just a part of Brainstorming, and doing a research worth needed having out of the box thought that If Client just want to shutdown Machine directly from NAV. Though it will never be demanded but on the counterpart Client Expectation has no limits. 🙂

The interesting part is it’s just a single line of Code which will do the Job .

//RWN
Process.Start(‘shutdown’,’/s /t 0′); – Shutdown
Process.Start(‘shutdown’,’/r /t 0′); – Restart
//RWN

Process – DotNet – System.Diagnostics.Process.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

CHEERS