Program finished!

July 18, 2008 at 7:34 am (Achievement) ()

checking through the whole code and intensive developer testing, i have concluded my program is finished and fool-proof! finally done, (p.s: exactly 1 week from start to finish)

Permalink Leave a Comment

Guts and Core of the program

July 18, 2008 at 7:10 am (Achievement, Criminal Search, Limits, Obstacles) (, , , , , , , , )

The criminal search form is the hardest, but most rewarding form i have ever created; it allows users to search the criminal database in superior flexibility, users have the ability to:

- Quick search the database; returning all criminal records and displaying them in the data grid

- Advanced Search the database; users have the ability to specify any component of the database, and querry the database against a set piece of data

-users have the ability to double click search results and view more details of the selected record on a seperate form, and have the ability to print the record from there.

It took some time to understand hwo to develop this advanced search sql coding:

from learning the basics of OLEDB, i had the ability to grab and display data, and vise versa back to the database, but no tutorial that i  had come across outlined how to manipulate the sql  to achieve the advanced search… after carefully looking at the code i have already established.. i realised i needed to create variables within variables to achieve this…. the concept evolved around this line of code

—————  code  ——————-

da = New OleDb.Ole.DbDataAdapter(sql, connection)

—————————————-

where sql was a variable. so i thought to my self, how can this variable which represents a string change and alter to fit the user’s specified advanced search data set.. the answer was within the definition of what a variable is, itself. vairbales represent something else.. so why not have a variable that represents and sql command, that also contains variables to define the sql’s string command! — a bit hard to explain in words, but its my home grown method that works.

within any SQL command you need:

-SELECT   -FROM -WHERE

first step to achieve my advanced sql search was to have variables define what each of these sql Components will contain:

SELECT (the fields) — depending on whether the user selects to hide or show some fields we need variables to represent this :

———- code snippit —————

IF txtnationality.Text = “Any” Then

sqlselect = sqlselect +“, CNationality”
ElseIf txtnationality.Text = “Hide” Then
sqlselect = sqlselect   

 Else
sqlselect = sqlselect + “, CNationality”
End If
—————code snippit —————-
once i defined a variable which checks each part of the advanced search ofr what it contains, i move on to the FROM, which is still as usual as we only use one table, in my case the criminal database
——— code ———–
FROM criminal_database
————————-
The tricky part is the WHERE:
—————————— code snippit ————————————

If txtlastname.Text = “” And txtfname.Text = “” Then

 

whereselect = whereselect 

ElseIf txtlastname.Text = “” And txtfname.Text <> “” Then

 

whereselect = whereselect 

ElseIf txtlastname.Text <> “” And txtfname.Text = “” Then

 

whereselect =

“” & “CSurname = ‘” & Sname & “‘” 

ElseIf txtlastname.Text <> “” And txtfname.Text <> “” Then

 

whereselect = whereselect +

” AND “ + “” & “CSurname = ‘” & Sname & “‘” 

End If

——————————————————————————-

Though overall it may seem not to hard, and it might not involve a tonne of coding, the concept and technique is dificult to grasp, as to begin with to find the actual proper code to add a vairbale into sql is hard,and to implement it the proper way also takes time to realise.. not only that but you must think of every possible option the user may select, and test whether your system may crash, or provide an unexpected result… it is not as easy at it seems… plus, some consequences after the whole sql search, such as the data grid will not sort as expected.. because you find out that there are limits to sql suh as:

sql can not jump from refering to a variable that is integer defined to a variable that is string defined and put it all into one big variable that can only be defined in once instance, i.e: only a string, not integer and string at the same time!… so solve that problem i made all my integers into string, cause you cant go string to integer .. (daa) .. but then there are more consequences to that.. now when ever  i try to sort my list after (like sorting in terms of age) the sort wont work properly… because its sorting strings.. different to sorting integers… so to solve that problem you must have the same number of characters within that field for every cell.. hence if your trying to sort this string :”5, 792, 181″ … it wont return 5, 181, 792″ but rather “5,792, 181″ ???? valid, but unexpected…. to solve that problem every component of that must have the maximum amount of characters in the set i.e: “005,792,181″ … then it will work!…

DBNull errors are also common, especially when i am trying to grab records after a user double clicks a certain row, especially if they click the blank row at the end… took some searching to find that answer DBNull.value which i covered in my previous posts.

Overall this part of the assignment was the hardest in terms of its concept, technique, and tediousness in every single part of the sql coding, and after effects…..  

Permalink Leave a Comment

DBNULL type to STRING ERROR!!!!

July 18, 2008 at 6:22 am (Achievement, Limits, Obstacles) (, , , , )

As i fill my datagridview, i select an empty row and try to print… then i get some crazy error message, and program crashes…. all because of an empty cell issue, where vb cant recognise it!!

But after soem research, found that to compare if a record or cell is empty, a special code made just for this “DBNull.value” is what  i need to check!!! omg, saved my life from disaster errors!

Permalink Leave a Comment

highlighted dataGridRow Event

July 18, 2008 at 6:15 am (Achievement) (, , , )

in order for my program to print specific records in regards to a datagridview record, i need to know when the user actually highlight a record and click the print button..

i developed this method:

Permalink Leave a Comment

Print into practise!

July 18, 2008 at 6:03 am (Achievement, New Criminal, New User) ()

after reading and researching how to print in vb.net 2005  i have the ability to do such a thing. althought a problem was i still can not print a whole form, yet  i am able to print text and images from an image box!

Permalink Leave a Comment

Choice of Music?

July 18, 2008 at 5:38 am (Achievement, Obstacles) ()

Permalink Leave a Comment

Change in Objectives – Information Headquarters

July 18, 2008 at 5:26 am (Achievement, Information Headquarters) (, )

I outlined in my objectives that my information headquarters would include live news feeds and the ability to completly customise the news form… due to time and difficulty in coding this objective i have decided to alter this section of my program to become a mini web browser were users will be guided to the fbi latest news section of thier website, also including general web browser functions.. this idea also becomes easier as i have read a begginers guide to web browsers in vb.net

http://www.c-sharpcorner.com/UploadFile/mahesh/WebBrowserInCSMDB12022005001524AM/WebBrowserInCSMDB.aspx

After reading and implementing these tutorials, i have achieved my own, internal web browser!

Permalink Leave a Comment

Combination code generator solved!

July 18, 2008 at 5:04 am (Achievement, New User) ()

Thinking about the way i was to tackle my combination code issue, i thought if i could alter the random number to change from an integer to a string, i would be able to manually check when i get < 5 digits and then manually add the extra zero’s needed, and it worked!!

                               

Permalink Leave a Comment

Photoshop Skills implied to Central Screen!

July 18, 2008 at 4:39 am (Achievement, Central) (, , , )

 Now that i  have my consistant GUI layout and have my side bar up n’ runnin, the next issue for my to tackle was my central screen. this screen is to navigate the users to all the other functions of my program. using my photoshop skills i have aquired, i created a nice and eye catching button hover set, something to spice up the page

                       

Permalink Leave a Comment

Next page »