Click here to Skip to main content
15,890,438 members
Home / Discussions / C#
   

C#

 
GeneralRe: Loading combobox with items on form load Pin
Muammar©4-Sep-07 19:39
Muammar©4-Sep-07 19:39 
GeneralRe: Loading combobox with items on form load Pin
Skippums4-Sep-07 13:04
Skippums4-Sep-07 13:04 
GeneralRe: Loading combobox with items on form load Pin
Muammar©4-Sep-07 19:37
Muammar©4-Sep-07 19:37 
Questionhow to show tooltip for checked list box items on mouse move in c#? Pin
nicolus3-Sep-07 23:24
nicolus3-Sep-07 23:24 
QuestionUnable to clear textbox Pin
PartyGitsu3-Sep-07 23:17
PartyGitsu3-Sep-07 23:17 
AnswerRe: Unable to clear textbox Pin
DaveyM696-Sep-07 8:40
professionalDaveyM696-Sep-07 8:40 
GeneralRe: Unable to clear textbox Pin
PartyGitsu6-Sep-07 20:34
PartyGitsu6-Sep-07 20:34 
GeneralRe: Unable to clear textbox Pin
DaveyM697-Sep-07 0:57
professionalDaveyM697-Sep-07 0:57 
It looks fine to me Confused | :confused:

This should work to get you out of trouble:

protected void btnSearchNumber_Click(object sender, EventArgs e)
{
try
{
string thisPDF = TextBox1.Text;
TextBox1.Text = "";
System.Windows.Forms.Application.DoEvents();
//readPDF gets the document from database
readPdf(thisPDF);
}
catch
{
lblNoPDF.Text = "NO PDF-DOCUMENT FOR GIVEN MRB WAS FOUND";
}
}

but I would like to know why it doesn't work in your original code!

Maybe, as an experiment, try returning a bool value from the readPdf

bool readPdf(string mrb)
{
try
{
DataRow row = handler.getReport(mrb).Tables[0].Rows[0];
Byte[] pdfData = (byte[])row["reportFile"];
int mrbID = (int)row["mrbID"];
Response.ContentType = "application/PDF";
Response.AddHeader("content-disposition", "attachment; filename = " + mrbID + ".pdf");
Response.BinaryWrite(pdfData);
return true;
}
catch
{
throw;
return false;
}
}

and show the result in a message box

protected void btnSearchNumber_Click(object sender, EventArgs e)
{
bool result;
try
{
//readPDF gets the document from database
result = readPdf(TextBox1.Text);
System.Windows.Forms.MessageBox.Show(result.ToString());
TextBox1.Text = "";
}
catch
{
lblNoPDF.Text = "NO PDF-DOCUMENT FOR GIVEN MRB WAS FOUND";
TextBox1.Text = "";
}
}


If you don't get a message box when the readPdf is successful then there's something seriously screwy going on somewhere.
GeneralRe: Unable to clear textbox Pin
DaveyM697-Sep-07 1:20
professionalDaveyM697-Sep-07 1:20 
QuestionWCF Transport :confused: Pin
Cape Town Developer3-Sep-07 23:03
Cape Town Developer3-Sep-07 23:03 
AnswerRe: WCF Transport :confused: Pin
originSH3-Sep-07 23:06
originSH3-Sep-07 23:06 
GeneralRe: WCF Transport :confused: Pin
Cape Town Developer3-Sep-07 23:11
Cape Town Developer3-Sep-07 23:11 
QuestionConsole application run as a windows service or command line in C# 2.0 Pin
Sundarapandian.Balasubramanian3-Sep-07 22:50
Sundarapandian.Balasubramanian3-Sep-07 22:50 
AnswerRe: Console application run as a windows service or command line in C# 2.0 Pin
originSH3-Sep-07 22:57
originSH3-Sep-07 22:57 
GeneralRe: Console application run as a windows service or command line in C# 2.0 Pin
originSH3-Sep-07 22:59
originSH3-Sep-07 22:59 
GeneralRe: Console application run as a windows service or command line in C# 2.0 Pin
Sundarapandian.Balasubramanian3-Sep-07 23:20
Sundarapandian.Balasubramanian3-Sep-07 23:20 
AnswerRe: Console application run as a windows service or command line in C# 2.0 Pin
Skippums4-Sep-07 13:10
Skippums4-Sep-07 13:10 
QuestionInstalling printer drivers with WMI Pin
diamakz3-Sep-07 22:13
diamakz3-Sep-07 22:13 
QuestionProgrammatic Router Port Mapping Pin
1242563-Sep-07 21:55
1242563-Sep-07 21:55 
AnswerRe: Programmatic Router Port Mapping Pin
originSH3-Sep-07 22:51
originSH3-Sep-07 22:51 
Questionsql server Pin
Sonia Gupta3-Sep-07 21:14
Sonia Gupta3-Sep-07 21:14 
AnswerRe: sql server Pin
Guffa3-Sep-07 21:20
Guffa3-Sep-07 21:20 
QuestionHash produces different results Pin
dotmartin3-Sep-07 21:03
dotmartin3-Sep-07 21:03 
AnswerRe: Hash produces different results Pin
dotmartin4-Sep-07 3:11
dotmartin4-Sep-07 3:11 
QuestionHow to append a file's all contents to an existing file Pin
tiasoft3-Sep-07 20:56
tiasoft3-Sep-07 20: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.