Untitled Document

open source masterhelp,macro, vba, word, cdma, component, delphi, excel

[Delphi] Simple Encrypt and Decrypt

to get secured password .. Simple way to Encrypt and Decrypt text

function Decrypt(const S: String): String;
var
I: byte;
t:string;
begin
for I := 1 to Length(S)div 2 do begin
t:=t+chr(ord(s[i])-64);
end;
result:=t;
end;
Continue Reading…

[Delphi]Get All Menus And Transfered to CheckListBox

How to get all menus in mainform of application..?

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, CheckLst;

type
TForm1 = class(TForm)
CheckListBox1: TCheckListBox;
Button1: TButton;
MainMenu1: TMainMenu;
File1: TMenuItem;
FileNewItem: TMenuItem;
FileCloseItem: TMenuItem;
N1: TMenuItem;
ResetWindowOptions1: TMenuItem;
ExportSettings1: TMenuItem;
Importsettings1: TMenuItem;
N5: TMenuItem;
FileExitItem: TMenuItem;
Edit1: TMenuItem;
CopyItem: TMenuItem;
PasteItem: TMenuItem;

Continue Reading…

[Delphi] Open schema ADO to ComboBox and Listbox

This day we Will show how to get tables name form database access.mdb using ADO.

For the first time we add unit in list uses

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;

Because we using ADO so we need unit ADODB and DB to get table function, after that put on our form

  • Combobox
  • Listbox
  • Button

ComboBox and ListBox as destination of tables name.

On Button1click write this code :

procedure TForm1.Button1Click(Sender: TObject);
var
TypeField,
NameField: TField;
TableType: string;
DataSet: TADODataSet;
ADOConnection:tADOConnection ;
data:string;
begin
data:=’C:\Program Files\lbi for windows\data\LBU200805.mdb‘; //Database access
// create ado connection
ADOConnection:=tADOConnection.create(nil);
ADOConnection.ConnectionString:=’Provider=Microsoft.Jet.OLEDB.4.0;Data Source=’+
data+’;Persist Security Info=False’;

Continue Reading…

[Delphi] Gradation Form

How to make gradation form in delphi

procedure TForm1.FormPaint(Sender: TObject);
var
y : longint ;
rect : TRect ;
begin
rect.Left := 0 ;
rect.Right := Width ;
for y := 0 to 255 do
begin
canvas.Brush.Color := TColor(RGB(0,y,y)) ;
rect.top := y * Height div 256 ;
rect.Bottom := (y+10) * height div 256 ;
canvas.FillRect(rect) ;
end;
end;

Get File Open on Excel

How to call open dialog file in excel..?

There is a way to read ini files in  windows directory using excel, we can choose file any kind of which wish to be read.  by calling open dialogue file at excel we will try reads contents of the  file line by line.

Application.GetOpenFilename(”ini Files (*.ini) ,*.ini“, 0, “Open As You Like“, “Open“, False)

Continue Reading…

How to Eliminate Zero Number in Front of Number

Some time we need a function in visual basic application but we never found that in VBA, so we must create by self that function. For example I have text number “0000100,00″ and I want to take  number “100,00″ only and I don’t need “0000″ in front of “100,00″ .

How to eliminate “0000″ …?

Continue Reading…

[Delphi] While do loop

A while statement is similar to a repeat statement, except that the control condition is evaluated before the first execution of the statement sequence. Hence, if the condition is false, the statement sequence is never executed.

The syntax of a while statement :

while expression do statement

Continue Reading…

[Delphi] For next loop

This lesson we learn about for.. next loop in delphi.

A for statement requires you to specify explicitly the number of iterations you want the loop to go through.

The syntax of a for statement is :

for counter := initialValue to finalValue do statement

or

for counter := initialValue downto finalValue do statement

where counter is a local variable (declared in the block containing the for statement) of ordinal type, without any qualifiers. initialValue and finalValue are expressions that are assignment-compatible with counter. statement is a simple or structured statement that does not change the value of counter.

Continue Reading…

[Delphi] 4 metodes to acces table

There are 4 metodes at least to acces table in delphi :

In this example i try use database from alias DBDEMOS and employee.db tablename. On show event I call dbdemos and employee table.

  • table1['firstname'];
  • table1.fieldbyname(’firstname’).AsString;
  • table1.Fields[2].AsString;
  • table1firstname.AsString;

Continue Reading…

[delphi] Export Data to Excel

This is delphi function to export data from delphi to excel. We still use ComOBj to create ole object excel

from delphi.

Uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComObj, Grids, StdCtrls, ExtCtrls, DBCtrls, DBGrids, DB,
DBTables;

  • XLApp := CreateOleObject(’Excel.Application’); –>command to call excel
  • XlBook:=XLApp.WorkBooks.Add; –>command to add workbook in excel
  • XlSheet := XlBook.worksheets.add; –> command to add worksheet in workbook
  • Go to the first record on table
  • create loop
  • write data on cell worksheet until end of file or last record

This is full function exportab( tab: Ttable; SFile: string): Boolean;

call function :

procedure TForm1.Button3Click(Sender: TObject);
begin

exportab(table1,’export at’+ FormatDateTime(’ dddd dd mmmm yyyy hh mm ss’, Now )+’.xls’);

end;

Continue Reading…