Code Library
無上正等正覺=ReSetDB NetImgGrafEx

  C#
web control(html control)
Java
JavaScript Flash BCB
Language structure *include way
*script way
  html中form submit之處理   Tips of BCB
Get a control by name/id TextBox tb = (TextBox)this.Controls.Find( "control_name", true)[0];
tb.Text = "Hello!";
 

html:
<div id="dvPH02" </div>

<script>
document.getElementById("dvPH02").innerHTML = strRes;

  if (m_aTag[i][j].SubString(1,5) == "level")
((TCGauge*)(this->FindComponent(m_aTag[i][j])))->Progress = StrToFloat(strValue);
else//edit control
((TEdit*)(this->FindComponent(m_aTag[i][j])))->Text = strValue;
Type Conversion Convert.ToInt32("21")
obj.ToString()
nValue=Integer.ValueOf(sValue)
sValue=String.ValueOf(nValue)
含Integer,Long,Float,Double
Integer.parseInt(str)
parseInt(...)
parseFloat(...)
parseInt(...)
parseFloat(...)
Number(...)
.toString()
StrToInt() 含Time,DateTime, Float,Curr
strVal = FormatFloat("###0.0", fVal);
*Format

//Web controls
txtWeb.Text
//Html elements
(Request.Form["txtTitle"])
(Request.queryString["txtTitle"] )
//Html elements run at server
txtHtml.Value

.getText()
.setText(str)
form1.edNum.value edNum = str .Text
.SelectedIndex
.SelectedItem.Value
.SelectedItem.Text
.Items.Add(...)
.Items[n].Selected = true
(Request.Form["cboFileType"] )
.clear()
.addItem(...)
.select(i)
.getSelectedIndex()
form1.cboZoom.value cboName.addItem(,)
cboName.getValue
一定要有
function onChange
{strName = cboName.getValue;}
->Text
->Items->...
.Items.Add(strTitle);
.Items.Remove(txtTodo.Text);
.Items[lstEx.SelectedIndex].ToString();
.SelectedIndex
.SelectedItem.ToString()
.clear()
.addItem(...)
.select(i)
.getSelectedIndex()
  on (release)
{system.useCode...
getUrl(".aspx", "_self", "GET");
loadVariables(".aspx", this, "POST");
}
->Items->String[0]
/Add()/Count/Clear()
/LoadFromFile/SaveToFile
radiobutton .Checked  

<td> <input type="radio" name="gender" value="先生"> 先生
<input type="radio" name="gender" value="小姐"> 小姐</td>

if (form1.gender[0].checked)//表先生

   
checkbox .Checked .getState() form1.chkAi.checked   ->Checked
元件化 ascx->user ctrl
cs->code behind
dll->library(放在bin檔案夾中)for web app
    #include "--.as"
by Export As File
如何使用STL:
#include <vector>
//std為其namespace
std::vector<int> m_vRepeated;
DataBase

Add
Delete
Edit
Show with DataGrid
Show with Table
Show with ListBox
Show with ComboBox

  xml2db duplicateMovieClip(
"dot", "dot"+i, i);
eval("dot"+i)._x =
100+25*i;
//dot為instance名
Database of BCB
TADOTable<-TADOQuery<-TADODataSet-(First(), Next(), Last(), Prior(), Insert(), Edit(), Post(), Bof, Eof, FieldCount, RecordCount, FieldByName("fld")->AsString, Field[i]->AsString
日期 DateTime.Now.Year
DateTime.Now.Month
DateTime.Now.Day
Date today = new Vector();
.getHours(), getMinutes()
.getSeconds()
var t = new Date();
.getHours()/.getDay()
/.getDate()/.getMonth()
/.getYear()
var t = new Date();
t.getFullYear();
t.getMonth+1;
t.getDate();
TDateTime
array int a[] = new int[8];
ArrayList, Queue, Stack...
int[] aValue = new int[42]
Vector vList = new Vector[21]
var a = new Array(20) aData = new Array(20); String aWord[100]
set m_htVerb = new Hashtable();
m_htVerb.Add(key, value);
value = m_htVerb[key];
       
random Random r = new Random();
int d = r.Next(nMax) or (nMin, nMax)
Random r = new Random(lSeed)
double d = r.next...
Math.random()...
Math.random():0-1 random(nMax)

#include <stdlib.h>

int random(nMax)

message MessageBox.Show(this, "...");   alert("...")
confirm ("...")
prompt(...,...)
  ShowMessage(...)
MessageBox(Null,str...)
directory

m_strConn = "...;data source =" +
Directory.GetCurrentDirectory()+
"\\kwsrch.mdb;";

conn = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Server.MapPath(".\\App_Data\\DB1.mdb"));

網頁的實體路徑
Request.PhysicalApplicationPath

       
string

 

      float a[17]; int i=0;
char* cP=new char[strData.Length()+1];
strcpy( cP, strData.c_str() );
//可作為斷字的分隔符號
char seps[] = ",";//" ()[]{}/\<>'|";
char *strSub;
strSub = strtok(cP, seps);
while (strSub != NULL)
{ AnsiString strWord(strSub);
a[i] = StrToFloat(strWord); i++;
strSub = strtok(NULL, seps); }
XML

 

   

onClipEvent (load) {
obj_xml = new XML();
obj_xml.load("bookdata.xml");
this.stop;
}
onClipEvent (enterFrame) {
if (obj_xml.loaded)
this.gotoAndStop(2);
}

obj_array = obj_xml.firstChild.childNodes;
txtID = obj_array[0].attributes.id;
txtBook = obj_array[0].childNodes[0].firstChild.nodeValue;
txtNum = obj_array[0].childNodes[1].firstChild.nodeValue;
txtPrice = obj_array[0].childNodes[2].firstChild.nodeValue;

 

Regular

Expression

//電話號碼:姓名
Regex r = new Regex("(?<num>[1-9]\\d+)[:](?<name>(\\w+\\s*)+)");
MatchCollection mc = r.Matches(strFlds);
m_nFldNum = Convert.ToInt32(mc[0].Groups["num"].ToString());
m_strFldName = mc[0].Groups["name"].ToString();
//:words you want
Regex r = new Regex("(?<=:)(\\w+\\s*)+");
MatchCollection mc = r.Matches(strKw);
strKw = mc[0].Value.ToString();
//句子和中英文的剖析
Regex rSent = new Regex("(\\w+(\\.\\d+)*\\s*)+(?!\\w)");
MatchCollection mcSent = rSent.Matches(strPara);
Regex rChnSeg = new Regex("([\\u3400-\\uFA2D]+\\s*)+");
//Regex rEng = new Regex("([A-Za-z0-9]+\\s)+(?!\\w)");
Regex rEngSeg = new Regex("[^\\u3400-\\uFA2D]+");
Regex rEngWord = new Regex("(\\w+(\\.\\d+)*)+");//[A-Za-z0-9]+
for (i=0; i<mcSent.Count; i++)
strSent = mcSent[i].Value.ToString();

str = "台北市110東興路59號6F";
Match m = Regex.Match(str,@"(?<city>\D+?)(?<zip>\d{3})(?<addr>.+)");
if (m.Success)
...m.Groups["city"].ToString()...

regexp=char+count

| = or, ex: (have|has|had)\s+been\s+\w+ing
->I have been waiting for you...

char用法
.=\n換行符號以外的所有字元
[aeiou]=any one, aeiou任一個字元均可
[^aeiou]=not, aeiou五個字元以外的字元皆可
[0-4a-fA-F]=serial,0-4表0,1,2,3,4均可
\w=word,中文+英文+數字+底線字元"_"
\W=not word,和\w相反
\s=space, 空白,\f,\n,\r,\t,\v等不會顯現的字元
\S=not space,和\s相反
\d=decimal,所有的數字(0-9)
\D=not decimal,所有的非數字

count用法
*={0,}, 表0次或多次
+={1,}, 表1次以上
?={0,1}, 表0次或1次
{n}= 表正好n次,ex:(pizza){2}->"pizzapizza"
{n,}= 表至少n次,ex:(abc){2,}
{n,m}= 表至少n次;但不超過m次

metacharacters:\用於還原特殊字元
. ^ $ * + ? { [ ] \ | ( )

group 用法
()= group unit
(?<name> )=
(?= )= ex:\w+(?=\d)->後面有數字的word
(?! )= ex: \b(?!un)\w+\b->前面無un的word
(?<= )= ex:(?<=19)99->前面有19的99
(?<! )

//代換用法
Regex rDotm = new Regex("'m");
strRaw = rDotm.Replace(strRaw, " am ");

//另一種Iteration
Regex r = new Regex("...");
Match m;

for (m=r.Match(str);m.Success;m=m.NextMatch())
{ ...m.Groups[1]
}

Noncapturing Subpatterns

There are two reasons to put parentheses around all or part of an RE. One is to make a quantifier (like * or +) apply to the parenthesized part. For instance, the RE Oh,( no!)+ would match Oh, no! as well as Oh, no! no! and so on. The other reason to use parentheses is that they capture the matched text. Captured text is used in back references, in "matching" variables in the regexp command, as well as in the regsub command.

If you don't want parentheses to capture text, add ?: after the opening parenthesis. For instance, in the example below, the subexpression (?:http|ftp) matches either http or ftp but doesn't capture it. So the back reference \1 will hold the end of the URL (from the second set of parentheses):

% set x http://www.activestate.com
http://www.activestate.com
% regsub {(?:http|ftp)://(.*)} $x {The hostname is \1} answer
1
% set answer
The hostname is www.activestate.com

C# include way

<%@ Page Language="c#" ContentType="text/html" ResponseEncoding="big5" Debug="true" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.Drawing" %>
<%@ import Namespace="System.Drawing.Drawing2D" %>
<%@ import Namespace="System.Collections" %>
<%@ import Namespace="System.ComponentModel" %>
<%@ import Namespace="System.Text.RegularExpressions" %>

C# script way

<script runat="server">
string m_strConn = "Provider=Microsoft.Jet.OleDb.4.0; data source = d:\\site_chemlab\\chemdb.mdb;";
int m_nLevel = 9;
//string m_strKind;
protected void Page_Load(Object Src, EventArgs E)
{
if (!IsPostBack)
{

Add

HttpPostedFile pfile = filename.PostedFile;
string strFile = Path.GetFileName(pfile.FileName);

if (strFile == "" || strFile == "void")
{
strFile = "void";
}
else
{
string strFileFull = "d:\\site_chemlab\\file_tomail\\" + strFile ;
pfile.SaveAs(strFileFull);
}

string strTitle = txtTitle.Text;
string strMonth = txtMonth.Text;
string strDate = txtDate.Text;
string strWeek = txtWeek.Text;
string strDay = txtDay.Text;

OleDbConnection conn = new OleDbConnection(ConnectionString);
string strInsertCmd = "INSERT INTO routine(title, file, monthr, dater, weekr, dayr) VALUES ('" + strTitle + "', '" + strFile + "'," + strMonth +", " + strDate + "," + strWeek + "," + strDay + ")";
OleDbCommand cmd = new OleDbCommand(strInsertCmd, conn);

try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();

Message.Text = "Add data successfully!";
BindGrid();
}
catch (OleDbException ex)
{
Message.Text = ex.ToString();
}


Delete

string keyValue = e.Item.Cells[2].Text;// = (string)DataGrid1.DataKeys[e.Item.ItemIndex];
// TODO: update the Command value for your application
OleDbConnection myConnection = new OleDbConnection(ConnectionString);
OleDbCommand DeleteCommand = new OleDbCommand("DELETE from routine where title='" + keyValue + "'", myConnection);
// execute the command
myConnection.Open();
DeleteCommand.ExecuteNonQuery();
myConnection.Close();

Edit

string strTitle = ((TextBox)e.Item.Cells[2].Controls[0]).Text;
string strFile = ((TextBox)e.Item.Cells[3].Controls[0]).Text;
string strMonth = ((TextBox)e.Item.Cells[4].Controls[0]).Text;
string strDate = ((TextBox)e.Item.Cells[5].Controls[0]).Text;
string strWeek = ((TextBox)e.Item.Cells[6].Controls[0]).Text;
string strDay = ((TextBox)e.Item.Cells[7].Controls[0]).Text;

// TODO: update the Command value for your application
OleDbConnection conn = new OleDbConnection(ConnectionString);
string strUpdate = "UPDATE routine SET file = '" + strFile + "', monthr = " + strMonth +", dater = " + strDate +", weekr = " + strWeek +", dayr = " + strDay +" WHERE title = '" + strTitle +"'";
OleDbCommand cmd = new OleDbCommand(strUpdate, conn);

// execute the command
try {
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
catch (Exception ex) {
Message.Text = ex.ToString();
}


Show with DataGrid

1.

String strConn = ConfigurationSettings.AppSettings["db_adhoc"];
OleDbConnection Conn = new OleDbConnection(strConn);
String strSql = "SELECT top 20 * from tLog order by fTime DESC";
OleDbCommand Cmd = new OleDbCommand(strSql, Conn);

Conn.Open();
dgLog.DataSource = Cmd.ExecuteReader();
dgLog.DataBind();
Conn.Close();

2.

OleDbConnection myConnection = new OleDbConnection(ConnectionString);
OleDbDataAdapter myCommand = new OleDbDataAdapter(SelectCommand, myConnection);

DataSet ds = new DataSet();
myCommand.Fill(ds);

DataGrid1.DataSource = ds;
DataGrid1.DataBind();


DB Show with Table

OleDbCommand Cmd = new OleDbCommand(strSql, Conn);
Conn.Open();
dr = Cmd.ExecuteReader();

HtmlTableRow objRow;
HtmlTableCell objCell;
int maxCells=dr.FieldCount;
int c = 0;
int r = 0;
String strCell;

while (dr.Read())
{
objRow = new HtmlTableRow();
if ((r % 2) == 0)// ]wCm
objRow.BgColor = "lightblue";

for (c = 0; c<maxCells; c++)
{
if (dr.GetName(c) == "img")
{ if (dr[c].ToString() == "void")
strCell = "";
else
strCell = "<a href = 'file/" + dr["type"].ToString() + "/image/" + dr[c].ToString() + "' target='_blank'>?</a>" ;
}
else if (dr.GetName(c) == "file")
{ if (dr[c].ToString() == "void")
strCell = "";
else
strCell = "<a href = 'file/" + dr["type"].ToString() + "/" + dr[c].ToString() + "' target='_blank'>?</a>" ;
}
else
{ strCell = dr[c].ToString();
}
objCell = new HtmlTableCell();
objCell.Controls.Add(new LiteralControl(strCell));
objRow.Cells.Add(objCell);
}

tblList.Rows.Add(objRow);
r++;
}
dr.Close();
Conn.Close();
if (r == 0)
Response.Write("Sorry, nothing to get!");


DB Show with ListBox

OleDbConnection Conn5 = new OleDbConnection(m_strConn);
string strSql = "select * from todo";
OleDbCommand Cmd5 = new OleDbCommand(strSql, Conn5);
Conn5.Open();
OleDbDataReader dr5 = Cmd5.ExecuteReader();
while (dr5.Read())
lstTodo.Items.Add(dr5["title"].ToString());
dr5.Close();
Conn5.Close();

DB Show with ComboBox

OleDbConnection Conn = new OleDbConnection(m_strConn);
Conn.Open();
String strSql1 = "select name from employee";
OleDbCommand Cmd1 = new OleDbCommand(strSql1, Conn);
cboWriter.DataSource = Cmd1.ExecuteReader();
cboWriter.DataTextField = "name";
cboWriter.DataValueField = "name";
cboWriter.DataBind();
Conn.Close();

//next binding
String strSql2 = "select * from type_km";
OleDbCommand Cmd2 = new OleDbCommand(strSql2, Conn);
Conn.Open();
cboType.DataSource = Cmd2.ExecuteReader();
cboType.DataTextField = "chn";
cboType.DataValueField = "eng";
cboType.DataBind();
Conn.Close();

JScript_xml2db

<SCRIPT LANGUAGE="JavaScript">
<!--
function addXml2Db() {
var strFile = "xml/" + form1.txtFile.value;
var root = loadXmlDoc(strFile);
//form1.txtMsg.value = strFile;
var strConn="'personkm','',''";//DSN connection
var Conn, RS;
Conn = new ActiveXObject("ADODB.Connection");
Conn.Open("personkm");
RS = new ActiveXObject("ADODB.RecordSet");
var strSql = "select * from contact";
RS.Open(strSql, Conn, 3, 3);
form1.txtMsg.value = "db is ok!";
var entity;
for ( var i=0; i<root.childNodes.length; i++ )
{
entity = root.childNodes(i);
RS.AddNew();
RS("name") = entity.childNodes(4).text;
RS("email") =entity.childNodes(6).text;
RS("category") = entity.childNodes(0).text;
RS("company") = entity.childNodes(1).text;
RS("address") = entity.childNodes(5).text;
RS("phone_office") = entity.childNodes(2).text;
RS("fax") = entity.childNodes(3).text;

RS.Update();
}

RS.Close();
Conn.Close();
form1.txtMsg.value = "that is ok now!";
}

//-->
</SCRIPT>

Database of BCB

Create Table

AnsiString str;

str = "CREATE TABLE " + edTableName->Text;
str += "(";
str += "seq_no INTEGER,";//序號欗位
str += "ts char(20),";//時序欗位

for (int i=0; i<8; i++)//共八個欄位
{
if (m_aIfRead[i])
str += m_aTitle[i] + " DOUBLE,";
}
str += "PRIMARY KEY(seq_no)";
str += ")";

Command1->CommandText = str;
Command1->Execute();

Fill the combo box

cboLevel->Items->Clear();

if (m_pSet->Active == true)
m_pSet->Close();

m_pSet->CommandText = "select content from type_level";
m_pSet->Open();

while (! m_pSet->Eof)
{
cboLevel->Items->Add(m_pSet->FieldByName("content")->AsString);
m_pSet->Next();
}

m_pSet->First();
m_pSet->Close();

Add Record

String strEng = edEng->Text;
String strChn = edChn->Text;
String strLevel = cboLevel->Text;

String strIns = "INSERT INTO word(eng, chn, kind) ";
strIns += "VALUES ('" + strEng + "','" + strChn + "','" + strLevel + "')";//各欄數值

m_pADOCmd->CommandText = strIns;
m_pADOCmd->Execute();//將資料寫入資料庫中

BCB_DateTime

TDateTime t = Date();
unsigned short *nYear, *nMonth, *nDay;
nYear = new unsigned short;
nMonth = new unsigned short;
nDay = new unsigned short;
t.DecodeDate(nYear, nMonth, nDay);
return IntToStr((*nYear)%100*10000+ (*nMonth)*100 + *nDay);

format of C

一個例子:

char tmp[133];
wsprintf(tmp, "%6.6s%-20.20s", "width", "name");
//也可用sprintf...

1.十進位數 %d, %nd, %-nd
//n表width, 負值表向左對齊

2.浮點數 %f, %m.nf
//m表width, n表小數點位數

3.字元 %c, %nc, %-nc

4.字串 %s, %ns, %-ns

5.科學記號(%e)8進位數(%o)Unsigned(%u)16進位數(%x)

atoi的用例(BCB):

TVariant* Param1;
AnsiString str = *Param1;

int ntmp = atoi(AnsiString(*Param1).c_str());

Escape Sequence
\a, alert
\b, backspace
\f, form feed
\n, new line
\r, carriage return
\t, horizontal tab
\v, vertical tab

BCB的用法


======
如何改Project的名稱
File/Save Project As...
======
*如何產生獨立的執行檔
1.Package tab
不選Build with runtime packages
2.Linker tab
不選Use dynamic RTL
======
*如何除錯
1.Project/Options...tab compiler,LK on Full Debugging
2.F5 for toggle break point
3.F9 for run
4.F8 for step over;F7 for trace into
5.Ctrl+Atl+L for local variable...
======
*字串用法
SubString(1, 6);//從1開始哦,6為count
======
//轉型用法
StrToDate
含Time,DateTime,Int,Float,Curr
======
*如何剪貼
Memo1->SelectAll();
Memo1->CopyToClipboard();
======
*如何存檔
文字檔(*.txt)|*.txt
所有檔案(*.*)|*.*

if (DlgSave->Execute())
mmRes->Lines->SaveToFile(DlgSave->FileName);
else
ShowMessage("無法存檔");
======
*Form的生與死
#include "unit2.h"
...
Form2->Show();//or ShowModal();
...
Close();
======
*強大的Items和Lines屬性
Count
Strings[0]
Add("test1")
Insert(5, "test")
Delete(1)
Clear()
LoadFromFile
SaveToFile
======
*時間表示
DateToStr(Date())->"2002/4/17"
TimeToStr(Time())->"AM 09:06:36"
int Taspgevw::CheckPW(int pw)
{//密碼正確傳回1,否則傳回0
TDateTime t = Date();
unsigned short *nYear, *nMonth, *nDay;
nYear = new unsigned short;
nMonth = new unsigned short;
nDay = new unsigned short;
t.DecodeDate(nYear, nMonth, nDay);
int nPW = (*nMonth + *nDay)*13;
if (nPW == pw)
return 1;
else
return 0;
}
======
//copyfile
#include <io.h>
#include <sys\stat.h>
#include <stdlib.h>
int TForm1::PCopyFile(char * cSource, char *cTarget)
{
int nIn, nOut, nBuf_len;
char* cBuf;

cBuf = (char*)malloc(1026);
if ((nIn = open(cSource, O_RDONLY|O_BINARY, S_IREAD)) == -1)
{ ShowMessage("無法開啟來源檔案!");
return 1;
}

if ((nOut = open(cTarget, O_CREAT|O_BINARY|O_WRONLY, S_IWRITE)) == -1)
{ ShowMessage("無法開啟目的檔案!");
return 1;
}

while (!eof(nIn))
{ nBuf_len = read(nIn, cBuf, 1024);
write(nOut, cBuf, nBuf_len);
}

close(nIn);
close(nOut);
free(cBuf);
return 0;
}

======
*趨勢圖
Chart { Series {Format, General, Marks, Data source
double v;
for (i=0;i<20;i++)
{ v = random(100)*1.0;
Series1->AddY(v, "", clRed);
}
//SeriesCount代表共有幾個趨勢線
for (t=0;t<(Chart1->SeriesCount());t++)
{ tmpX = (Chart1->Series[t]->XValues->Value[1]...)
}
//刪除第一筆資料,且將後面資料往前挪
Chart1->Series[t]->Delete[0];
//將新資料加至最後一筆
Chart1->Series[t]->AddXY(
Chart1->Series[t]->XValues->Last()+tmpX,
Chart1->Series[t]->YValues->Last()+random(50),
"", clRed);
======
//資料錄之開啟和讀取
void __fastcall TForm1::btnSrchQryClick(TObject *Sender)
{
if (pSet->Active == true)
pSet->Close();

AnsiString strRes;

pSet->CommandText=edQuery->Text;
pSet->Open();
Memo1->Clear();

int nCount = pSet->FieldCount;
int i=1, j;
while (!pSet->Eof)
{ strRes = IntToStr(i++) + ".";
for (j=0; j<nCount; j++)
{ strRes += pSet->Fields->Fields[j]->AsString;
}
Memo1->Lines->Add(strRes);
pSet->Next();
}
}

======
//資料庫中找資料
void __fastcall TfrmEdit::btnEditClick(TObject *Sender)
{
TLocateOptions Opts;
Opts.Clear();
Opts << loPartialKey;

AnsiString strEng = edEng->Text;
AnsiString strChn = edChn->Text;

if (m_pSet->Locate("eng", strEng, Opts))
{ m_pSet->Edit();
m_pSet->FieldByName("chn")->AsString = strChn;
m_pSet->Post();
radExist->Checked = true;
}
else
{ m_pSet->Insert();
m_pSet->FieldByName("chn")->AsString = strChn;
m_pSet->FieldByName("eng")->AsString = strEng;
m_pSet->Post();
radExist->Checked = false;
}
}

======
//在程式中用SQL產生資料表
CREATE TABLE NewCusts
(
CustNo INTEGER NOT NULL,
Company CHAR(40),
State CHAR(2),
PRIMARY KEY(CustNo)
)
//integer,double,float,long,single
INSERT INTO Customer
(CustNo, Company, State)
VALUE(9999, 'Night Tuxedos', 'CA')
//TADOCommand應用下列成員來實作
CommandType=cmdText
CommandText=your SQL
Execute to complete.

//和VC的比較
good
1.setup較好用
2.VCL for UI,如DBGrid
3.Items和Lines相當強大
4.型態轉換很便利
5.RichEdit可Print各UI元件,Copy,Save很直接
6.可直接存取DB中Table的Field value
7.對ADO的使用比VC的ODBC或DAO皆較為簡單且強大
8.背景圖
bad
1.Automation Creation via MFC較為容易
2.如tsaocap的應用程式

html中form submit之處理

<script language=javascript>
function check(){
if(!trim(form.company.value)){alert('.請輸入公司/單位');form.company.focus();return false;}
if(!trim(form.name.value)){alert('.請輸入姓名');form.name.focus();return false;}
if(!form.gender[0].checked && !form.gender[1].checked){alert('.請選擇性別');form.gender[0].focus();return false;}
if(!trim(form.tel.value)){alert('.請輸入聯絡電話');form.tel.focus();return false;}
if(!trim(form.content.value)){alert('.請輸入內容');return false;}
form.btnSubmit.disabled = true;
form.submit();
}
function trim(instr){
return instr.replace(/^[\s]*/gi,'').replace(/[\s]*$/gi,'');
}
</script>

<form name="form" method="post" action="contact_send.asp">
<table width="80%" border="1" align="center" cellpadding="5" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#D6D3D6">
<tr>
<td bgcolor="#E8E8E8"><table width="93%" align="center">
<tr>
<td width="15%" class="bodytxt9"><font face="Webdings">4</font>
公司/單位</td>
<td width="85%"><input name="company" type="text" class="form01" size="30">
<span class="bodytxt9">部門/系所
<input name="division" type="text" class="form01" size="8">
</span></td>
</tr>
<tr>
<td class="bodytxt9"><font face="Webdings">4</font>
姓名</td>
<td><input name="name" type="text" class="form01" size="30">
<input type="radio" name="gender" value="先生">
<span class="bodytxt9">先生 </span> <input type="radio" name="gender" value="小姐">
<span class="bodytxt9">小姐</span></td>
</tr>
<tr>
<td class="bodytxt9"><font face="Webdings">4</font>
連絡電話</td>
<td><input name="tel" type="text" class="form01" size="30">
<span class="bodytxt9">分機
<input name="telext" type="text" class="form01" size="8">
</span></td>
</tr>
<tr>
<td class="bodytxt9"><font face="Webdings">4</font>
傳真<br></td>
<td><input name="fax" type="text" class="form01" size="30"></td>
</tr>
<tr>
<td class="bodytxt9"><font face="Webdings">4</font>
地址</td>
<td><input name="address" type="text" class="form01" size="50"></td>
</tr>
<tr>
<td class="bodytxt9"><font face="Webdings">4</font>
e-mail</td>
<td><input name="email" type="text" class="form01" size="50"></td>
</tr>
<tr>
<td valign="top" class="bodytxt9"><font face="Webdings">4</font>
網址</td>
<td><input name="website" type="text" class="form01" value="http://" size="50"></td>
</tr>
<tr>
<td colspan="2" valign="top" class="bodytxt9"><hr size="1"></td>
</tr>
<tr>
<td valign="top" class="bodytxt9"><font face="Webdings">4</font>
廠牌</td>
<td class="bodytxt9"><font color="#2969D6">請勾選您需要的廠牌服務,我們會儘快與您聯絡:</font><br>
<table width="100%" border="0">
<tr class="bodytxt9">
<td width="35%"> <input type="radio" name="brand" value="ANCER">
ANCER</td>
<td width="21%"> <input type="radio" name="brand" value="AND">
AND</td>
<td width="44%"> <input type="radio" name="brand" value="BIO-TEK">
BIO-TEK</td>
</tr>
<tr class="bodytxt9">
<td> <input type="radio" name="brand" value="BROOKFIELD">
BROOKFIELD</td>
<td> <input type="radio" name="brand" value="BUCHI">
BUCHI</td>
<td> <input type="radio" name="brand" value="CBC">
CBC</td>
</tr>
<tr class="bodytxt9">
<td> <input type="radio" name="brand" value="CHYO">
CHYO</td>
<td> <input type="radio" name="brand" value="CMF">
CMF</td>
<td> <input type="radio" name="brand" value="ELLAB">
ELLAB</td>
</tr>
<tr class="bodytxt9">
<td> <input type="radio" name="brand" value="FMI FLUID">
FMI FLUID</td>
<td> <input type="radio" name="brand" value="LAUDA">
LAUDA</td>
<td> <input type="radio" name="brand" value="METERTECH">
METERTECH</td>
</tr>
<tr class="bodytxt9">
<td> <input type="radio" name="brand" value="NIPPON DENSHOKU">
NIPPON DENSHOKU</td>
<td> <input type="radio" name="brand" value="SAVANT">
SAVANT</td>
<td> <input type="radio" name="brand" value="SCHLEICHER &amp; SCHUELL">
SCHLEICHER &amp; SCHUELL</td>
</tr>
<tr class="bodytxt9">
<td> <input type="radio" name="brand" value="SETRA">
SETRA</td>
<td> <input type="radio" name="brand" value="SHELLAB">
SHELLAB</td>
<td> <input type="radio" name="brand" value="YMC">
YMC</td>
</tr>
<tr class="bodytxt9">
<td> <input type="radio" name="brand" value="ADAM">
ADAM</td>
<td> <input type="radio" name="brand" value="VWR">
VWR</td>
<td> <input type="radio" name="brand" value="LENTON">
LENTON</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top" class="bodytxt9"><hr size="1"></td>
</tr>
<tr>
<td valign="top" class="bodytxt9"><font face="Webdings">4</font>
服務需求</td>
<td valign="top" class="bodytxt9"><table width="100%" border="0" class="bodytxt9">
<tr>
<td width="30%"><input type="checkbox" name="service" value="提供報價">
提供報價</td>
<td width="33%"><input type="checkbox" name="service" value="提供產品型錄">
提供產品型錄</td>
<td width="37%"><input type="checkbox" name="service" value="提供產品規格">
提供產品規格</td>
</tr>
<tr>
<td><input type="checkbox" name="service" value="產品維修">
產品維修</td>
<td><input type="checkbox" name="service" value="請派員解說">
請派員解說</td>
<td><input type="checkbox" name="service" value="提供進基綜合目錄">
提供進基綜合目錄</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top" class="bodytxt9"><hr size="1"></td>
</tr>
<tr>
<td valign="top" class="bodytxt9"><font face="Webdings">4</font>
留言標題</td>
<td><input name="title" type="text" class="form01" size="70"></td>
</tr>
<tr>
<td valign="top" class="bodytxt9"><font face="Webdings">4</font>
留言內容</td>
<td><textarea name="content" cols="72" rows="5" class="form01"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="button" name="btnSubmit" value="送出資料" onclick=check(); style=cursor:hand;>
 
<input type="reset" value="清除重填" style=cursor:hand;></td>
</tr>
</table></td>
</tr>
</table>
</form>