Learn the Rules, Break The Rules, and Create the New Ones...

Hi... My name is Rizky Prihanto. You can call me RQ, or Rizky either. I am currently living on Bandung, Indonesia. Had a lot of works and research about Enterprise Information Systems (majoring on education and e-governments). I have bunch of interests (some friends call it 'freakz') about MySQL Opensource Database and now I am one of the administrator of MySQL Indonesia User Group - the opensource community initialized by Sun Microsystems Indonesia.

My Company PT Cinox Media Insani, Bandung, Indonesia. I work here since 2008 and I take responsibility as Chief of Software Architect. My job is about planning, imaginating, fantasy-ing, concepting, and build the infrastructure of the new information systems (or app engines) which going to be implemented.

This blog This is my blog that represent my current opinion, research and experiences about anything in Software Engineering. Written since 2007 (actually) and has been vaccum for a lot of while. And now I wanna ressurrect this blog (optimistically) from the long-long-hibernation with something fresh and new ideas -- still about MySQL, software engineering, development, and may be something managerial here.

About the tagline I've learned the statement above from some paper written by Kent Beck about Extreme Programming (XP) methodology -- some sort of practical software development methods which have no boundaries. That's very inspiring me a lot. I have written some article on this blog that tell my interpretation about that statement here.

My Another Blogs I have classifying my blogs into some sort of genre. The blog that you read here right now is my primary blog that tell you (majoring) about IT stuff. But if you wanna look another side of me, you can visit here, here, here,or here. Hope it'll be interesting for some of you.

Credits I would thanks to Blogger for this great blog platform. Skinpress who designed this Wordpress template (which is bloggerized by Free Blogger Templates). My appreciate is also going to you who give your generously time for visiting my blog.

if isRunningDariVB = true...

Kadang pas lagi ndevelop code, kita suka masang2 msgbox di control2 seperti label, image, ato object2 lain utk melakukan pengecekan code. Yah, misalnya utk ngecek lebar form kah, ato ngecek lebar kolom listview kah, ato ngecek hal2 lain yg ngga bisa dilakukan tanpa meng-compile (ato pake immediate window).. Kegiatan model gini umum disebut "meng-capture nilai property control pas runtime" (ini istilah yg aku buat sendiri sih, ngga resmi n ngga ilmiah xixixi). Fungsinya cuman utk menunjang konstruksi aplikasi aja, bukan utk ditujukan ke interaksi end-user...

Nah, kadang pas aplikasi udah kelar, kita lupa ngapus tu msg-msgbox. Akhirnya, pas ada user yg ngga sengaja nge-klik control yg tadinya kita pasang msgbox itu ~ bisa-bisa nongol deh tu msgbox. Huh..., malu-maluin aja...

Sebenarnya, teknik meng-capture property control pake msgbox itu ngga terlalu bagus utk dibiasakan... Kita bisa manfaatin immediate window sbg output. Misal biasanya kita menuliskan code begini

MsgBox "FChild.Width = " & FChild.width & vbNewLine & "FChild.Height = " & FChild.Height

bisa kita ganti jadi :

debug.print "FChild.Width = " & FChild.width & vbNewLine & "FChild.Height = " & FChild.Height

fungsinya sama!

cuma, klo pake debug.print - informasi width/height yg kita inginkan itu munculnya di immediate window. Immediate Window? Makanan jenis apa itu?? Coba tekan Ctrl-G. Ntar muncul tuh form nya.

Tapi,

ada kalanya ngga keren jg make debug.print. Nggak eye-catching. Lagian, pasti njengkelin klo di event-event sebelumnya kita jg munculin debug.print, bakal penuh tu immediate window n mo nyari nilai property control pas runtime akan makin menjengkelkan. ribet.

... kembali ke metode msgbox ? ...

Boleh...
(ntar jangan lupa di-bersihin code nya ya klo dah mo mbikin EXE)


... wah form ku ratusan, Q. kadang aku butuh delivery EXE scr cepat ke client utk demo-in progress ku... gimana ya. ngga ada waktu utk ngebersihin code ku. kmu ada teknik lain?...


ADA!

(tapi, sebelumnya, janji dulu... pas aplikasimu bener2 mau kmu launching ~ bukan sekedar prototyping or demoin progress thox ~ kmu tetep harus ngebersihin code mu dari sampah2 code.)

... iya deh, aku janji...


OKE

begini,
coba bikin function ini :

Public Function IsRunningDariVB() As Boolean
On Error GoTo Hell
Debug.Print 1 / 0
IsRunningDariVB = False
Exit Function

Hell:
IsRunningDariVB = True
End Function

trus, utk contoh cara pemakaiannya :

Private Sub Label1_click()
if isRunningDariVB = true then
msgbox "FChild.Width = " & FChild.width & vbNewLine & "FChild.Height = " & FChild.Height
end if
End Sub


udah, beres. Klo u ngeklik Label1 pas ngompile biasa dari VB, akan muncul msgboxnya. Tapi, pas u udah bikin EXE trus u coba jalanin tu EXE n coba ngeklik Label1 ~ ngga bakal muncul messagebox apa-apa..

gimana?

keren kan?

Abang Qvezst emang tidak diragukan lagi ke-cakep-an face nya.... xixixi


Wassalam,


Qvezst.

PS : Ingat janjimu utk ngebersihin code pas u bener-bener siap nge-deploy aplikasi mu. Awas klo nggak!

1 comments:

madhi mengatakan...

itu karena debug.print sesuatu yg error ya..klo udah jadi exe debug.print akan di by pass ya. seep...

Posting Komentar