Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 06-12-2012
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
dvd2000,

Revisa este código:
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, StdCtrls, DBCtrls, DB, ADODB, Mask;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    DBGrid1: TDBGrid;
    Memo1: TMemo;
    DBMemo1: TDBMemo;
    ADOConnection1: TADOConnection;
    ADOTable1: TADOTable;
    DataSource1: TDataSource;
    DBEdit1: TDBEdit;
    procedure DBMemo1KeyPress(Sender: TObject; var Key: Char);
    procedure DBGrid1KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure Memo1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

const
   MaxLongComment = 30;

var
  Form1: TForm1;
  CountChar : Integer;

implementation

{$R *.dfm}

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
   if (Length(Edit1.Text) >= MaxLongComment) and (Key <> #8) then
   begin
      Key := #0;
      ShowMessage('Máxima longitud alcanzada');
   end
end;

procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
   if (Length(Memo1.Text) >= MaxLongComment) and (Key <> #8) then
   begin
      Key := #0;
      ShowMessage('Máxima longitud alcanzada');
   end
end;

procedure TForm1.DBEdit1KeyPress(Sender: TObject; var Key: Char);
begin
   if (Length(DBEdit1.Text) >= MaxLongComment) and (Key <> #8) then
   begin
      Key := #0;
      ShowMessage('Máxima longitud alcanzada');
   end
end;

procedure TForm1.DBMemo1KeyPress(Sender: TObject; var Key: Char);
begin
   if (Length(DBMemo1.Text) >= MaxLongComment) and (Key <> #8) then
   begin
      Key := #0;
      ShowMessage('Máxima longitud alcanzada');
   end
end;

procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
   if DBGrid1.Fields[DBGrid1.SelectedIndex]=(DBGrid1.DataSource.DataSet.FieldByName('Author')) then
   begin
      if DBGrid1.Controls[0] is TInPlaceEdit then
      with DBGrid1.Controls[0] as TInPlaceEdit do
      begin
         if (GetTextLen >= MaxLongComment) and (Key <> #8) then
         begin
            Key := #0;
            ShowMessage('Máxima longitud alcanzada');
         end;
      end;
   end;
end;

end.
El código anterior muestra ejemplos de como controlar la longitud de un texto en un control de entrada.

Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 06-12-2012 a las 20:00:42.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Delphi for PHP y DBgrid dante148 Internet 1 04-10-2011 22:56:15
DbGrid en Delphi 7 drakkon Varios 3 27-12-2007 04:42:08
Delphi for php- dbgrid omarifr PHP 2 12-10-2007 17:02:54
DBGrid en delphi 5 ibbeth SQL 1 03-01-2006 02:38:05
Delphi + MySQL (DBGrid) gringo Conexión con bases de datos 5 23-10-2004 04:44:31


La franja horaria es GMT +2. Ahora son las 14:58:10.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi