原帖由 sckds 於 2008-10-21 19:41 發表


ching , 個 KeyChar 點彈出黎架 ?

小弟初學 , 問左低能野有怪莫怪


you need to select what event of the textbox you want to happen ( keypress is your key)
put this code to this event

TOP

原帖由 sckds 於 2008-10-21 19:29 發表


1. 就係唔想咁
我想放係if 入面
if (statement){
show error;
reload;
}

2. 請問 code 點寫 ?

thx~


1. Why?

TOP

原帖由 rocketdive04 於 2008-10-21 07:42 PM 發表


what kind of error you want to show?


specific exception error

TOP

原帖由 rocketdive04 於 2008-10-21 07:44 PM 發表


you need to select what event of the textbox you want to happen ( keypress is your key)
put this code to this event


得左

thx so much

[ 本帖最後由 sckds 於 2008-10-21 19:54 編輯 ]

TOP

原帖由 thinkpanda 於 2008-10-21 07:46 PM 發表


1. Why?


coz exception 出既 error 唔 specific

so use if statement

but show jor error 後冇 "後著" , 會hang左係度

[ 本帖最後由 sckds 於 2008-10-21 20:10 編輯 ]

TOP

  1. try{
  2.    if(statement){
  3.       throw new Exception("ABC");
  4.    }
  5. }catch (Exception e)
  6. {
  7.   if(e.Message == "ABC") {
  8.     show();
  9.     reload();
  10.   }
  11. }
複製代碼
how about this ?
or you write a new kind of Exception

[ 本帖最後由 chiefumpire 於 2008-10-21 21:55 編輯 ]

TOP

係咪 用 do ,While好點?

While(條件)
{
show error;
if (error); // While Looping
if (no error); // while (條件 false ,out while

}

do
{
一樣,如(條件為false,出 do Looping

While(條件);

只供參考....................!!!

TOP

唔用 try catch block 點知有error
除非你預計到會出d logic  既error 啦
if (customer <> male && customer <> female )
{ return error; }
否則其他error 要大d effort 先搵到喎

TOP