我的窗体上有70个Edit控件,怎样判断它们的Text属性都不为空?难道要and +and 的一个一个加下去?

yundou 2003-10-15 03:02:14
我的窗体上有70个Edit控件,怎样判断它们的Text属性都不为空?难道要and +and 的一个一个加下去?
...全文
45 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
wlmmlw 2003-10-16
  • 打赏
  • 举报
回复
有必要搞这么多个EDIT吗?
mestars 2003-10-16
  • 打赏
  • 举报
回复
这个窗口够大 *_*
gdwyh 2003-10-15
  • 打赏
  • 举报
回复
同意一楼
tncboy 2003-10-15
  • 打赏
  • 举报
回复
收了!!
hanly2008 2003-10-15
  • 打赏
  • 举报
回复
我更晚了~~~
47522341 2003-10-15
  • 打赏
  • 举报
回复
来晚了;^_^
huaervvhuaer 2003-10-15
  • 打赏
  • 举报
回复
function Tform1.isnotnull():boolean;
var
I: Integer;
begin
for I := 0 to ComponentCount - 1 do
if Components[I] is TEdit then
if TEdit(Components[I]).Text = '' then
begin
result:=false;
exit;
end;
result:=true;
end;
noil0125 2003-10-15
  • 打赏
  • 举报
回复
var
I,count: Integer;
begin
count:=0;
for I := 0 to ComponentCount - 1 do
if Components[I] is TEdit then
if TEdit(Components[I]).Text <> '' then
inc(count);
if count=70 then
//70个Edit控件,它们的Text属性都不为空要经常的操作
end;
myfine 2003-10-15
  • 打赏
  • 举报
回复
用一个循环
tanqth 2003-10-15
  • 打赏
  • 举报
回复
就是楼上的办法
飛無痕 2003-10-15
  • 打赏
  • 举报
回复
var
I: Integer;
begin
for I := 0 to ComponentCount - 1 do
if Components[I] is TEdit then
if TEdit(Components[I]).Text <> '' then
begin
ShowMessage(Components[I].Name + ' is not null.');
Abort;
end;
end;
作者: 三角猫 出处: http://www.zu14.cn/ 版权归 三角猫 和 真有意思网 所有,转载请注明出处 using System; using System.Collections.Generic; using System.Text; namespace QQAutoMsg { /// /// 消息发送 /// internal static class QQMsgSender { /// /// 发送消息 /// /// 所以已打开的QQ窗体的列表 /// 消息内容 internal static void Go(List qqChatWindows, string msg) { foreach (EnumQQChatWindows.QQChatWindow win in qqChatWindows) { SendMsg(win.WindowHwnd, msg); } } /// /// 根据窗体句柄,找到输入框和发送按钮,发送消息出去 /// /// 聊天窗口句柄 /// 消息内容 private static void SendMsg(IntPtr hWnd, string msg) { if (NativeMethods.IsWindow(hWnd)) //确认该聊天窗口仍然有效 { ////找到 发送 按钮 IntPtr hwndButton = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "Button", "发送(S)"); if (IntPtr.Zero != hwndButton) { ////找到窗体顺序上的第一个RichEdit20A控件,其实就是消息显示框 IntPtr hwndRichEdit = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "RichEdit20A", null); ////利用spy++,可以看到消息输入框的父窗体是类名为 AfxWnd42 的控件 ////在顺序上是显示框的下一个窗体 if (IntPtr.Zero != hwndRichEdit) { ////找到 AfxWnd42 这个窗体 hwndRichEdit = NativeMethods.GetWindow(hwndRichEdit, NativeMethods.GW_HWNDNEXT); if (IntPtr.Zero != hwndRichEdit) { ////这才是真正的消息输入框 hwndRichEdit = NativeMethods.FindWindowEx(hwndRichEdit, IntPtr.Zero, "RichEdit20A", null); if (hwndRichEdit != IntPtr.Zero) { ////发送消息,因为QQ屏蔽了 WM_SETTEXT, WM_PASTE 命令,所有采用 EM_REPLACESEL 来实现 NativeMethods.SendMessage(hwndRichEdit, NativeMethods.EM_REPLACESEL, IntPtr.Zero, msg); ////给发送按钮发 鼠标单击消息 NativeMethods.SendMessage(hwndButton, NativeMethods.BM_CLICK, IntPtr.Zero, IntPtr.Zero); } } } } } } } }

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧