Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
AnswerRe: Debug.WriteLine Pin
Abhinav S31-Jan-11 20:04
Abhinav S31-Jan-11 20:04 
QuestionExecute code only if query successful Pin
Joe Stansfield31-Jan-11 11:29
Joe Stansfield31-Jan-11 11:29 
AnswerRe: Execute code only if query successful Pin
Not Active31-Jan-11 12:07
mentorNot Active31-Jan-11 12:07 
QuestionRe: Execute code only if query successful Pin
Paw Jershauge31-Jan-11 12:24
Paw Jershauge31-Jan-11 12:24 
AnswerRe: Execute code only if query successful Pin
RobCroll31-Jan-11 12:33
RobCroll31-Jan-11 12:33 
AnswerRe: Execute code only if query successful Pin
Pravin Patil, Mumbai31-Jan-11 19:03
Pravin Patil, Mumbai31-Jan-11 19:03 
AnswerRe: Execute code only if query successful Pin
Michael Kingsford Gray1-Feb-11 1:09
Michael Kingsford Gray1-Feb-11 1:09 
GeneralRe: Execute code only if query successful Pin
Joe Stansfield1-Feb-11 11:10
Joe Stansfield1-Feb-11 11:10 
Sorry about the delay in getting back to you all - have been out of the office and based in Australia.

Code that executes with the query is as follows:
try
{
    //Run query to open file
    this.file_InfoTableAdapter.fFile_File_Open(this.salesDataSet.File_Info, ((int)(System.Convert.ChangeType(fFile_Open_File_Text_Box.Text, typeof(int)))));

    //Sort sales dgv to sort by date
    this.saleInformationDataGridView.Sort(this.saleInformationDataGridView.Columns["dataGridViewTextBoxColumn9"], ListSortDirection.Descending);

    //Set photo list box to display correct photo list
    photoListBox.Items.Clear();
    photoListBox.Items.Add(file_NameTextBox.Text + "_a.jpg");
    photoListBox.Items.Add(file_NameTextBox.Text + "_b.jpg");
    photoListBox.Items.Add(file_NameTextBox.Text + "_c.jpg");
    photoListBox.Items.Add(file_NameTextBox.Text + "_d.jpg");

    //Display first file photo if one exists
    string photoDisplay = "P:\\" + localityTextBox.Text + "\\" + file_NameTextBox.Text + "_a.jpg";
    this.photoBox.ImageLocation = photoDisplay;

    //Set property sale detail text boxes back to read only
    land_use_codeTextBox.ReadOnly = true;
    land_areaTextBox.ReadOnly = true;
    construction_yearTextBox.ReadOnly = true;
    room_countTextBox.ReadOnly = true;
    wall_construction_codeTextBox.ReadOnly = true;
    roof_construction_codeTextBox.ReadOnly = true;
    building_areaTextBox.ReadOnly = true;
}
catch (System.Exception ex)
{
    System.Windows.Forms.MessageBox.Show(ex.Message);
}


I have limited knowledge about avoiding exceptions, but it is my understanding that all the code underneath the running of the query is being run even if the query returns no result? Leading to the exception?

But to be honest, I really have no idea... I do know that there is a lot I could improve in the code, but it is a very much "Learn as I go" approach... Which of course isn't the best, but I can only learn and get better!

Joe
AnswerRe: Execute code only if query successful Pin
meaningoflights1-Feb-11 17:58
meaningoflights1-Feb-11 17:58 
QuestionHow to load 100,000 list view items without application freeze? Pin
Chesnokov Yuriy31-Jan-11 3:23
professionalChesnokov Yuriy31-Jan-11 3:23 
AnswerMessage Removed Pin
31-Jan-11 3:38
Pravin Patil, Mumbai31-Jan-11 3:38 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Chesnokov Yuriy31-Jan-11 4:02
professionalChesnokov Yuriy31-Jan-11 4:02 
AnswerRe: How to load 100,000 list view items without application freeze? PinPopular
Dave Kreskowiak31-Jan-11 3:40
mveDave Kreskowiak31-Jan-11 3:40 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Chesnokov Yuriy31-Jan-11 4:01
professionalChesnokov Yuriy31-Jan-11 4:01 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Richard MacCutchan31-Jan-11 4:05
mveRichard MacCutchan31-Jan-11 4:05 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
OriginalGriff31-Jan-11 4:09
mveOriginalGriff31-Jan-11 4:09 
AnswerRe: How to load 100,000 list view items without application freeze? Pin
Chesnokov Yuriy31-Jan-11 6:40
professionalChesnokov Yuriy31-Jan-11 6:40 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Eddy Vluggen31-Jan-11 7:13
professionalEddy Vluggen31-Jan-11 7:13 
AnswerRe: How to load 100,000 list view items without application freeze? Pin
Chesnokov Yuriy31-Jan-11 9:48
professionalChesnokov Yuriy31-Jan-11 9:48 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Pete O'Hanlon31-Jan-11 9:50
mvePete O'Hanlon31-Jan-11 9:50 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Eddy Vluggen31-Jan-11 10:44
professionalEddy Vluggen31-Jan-11 10:44 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Not Active31-Jan-11 12:13
mentorNot Active31-Jan-11 12:13 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Fabio Franco1-Feb-11 4:08
professionalFabio Franco1-Feb-11 4:08 
GeneralRe: How to load 100,000 list view items without application freeze? Pin
Dave Kreskowiak31-Jan-11 7:34
mveDave Kreskowiak31-Jan-11 7:34 
AnswerRe: How to load 100,000 list view items without application freeze? Pin
Chesnokov Yuriy31-Jan-11 9:56
professionalChesnokov Yuriy31-Jan-11 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.