Click here to Skip to main content
15,908,906 members
Home / Discussions / C#
   

C#

 
GeneralRe: Windows Service Urgent!!! Pin
Talktorajeev19-Oct-05 0:18
Talktorajeev19-Oct-05 0:18 
GeneralRe: Windows Service Urgent!!! Pin
leppie19-Oct-05 1:38
leppie19-Oct-05 1:38 
GeneralRe: Windows Service Urgent!!! Pin
Talktorajeev19-Oct-05 2:11
Talktorajeev19-Oct-05 2:11 
AnswerRe: Windows Service Urgent!!! Pin
leppie19-Oct-05 2:41
leppie19-Oct-05 2:41 
QuestionDetecting Sql Server Pin
_Hacker18-Oct-05 21:48
suss_Hacker18-Oct-05 21:48 
AnswerRe: Detecting Sql Server Pin
leppie18-Oct-05 22:17
leppie18-Oct-05 22:17 
QuestionScroll Position of the tree view control Pin
deejagan18-Oct-05 21:32
deejagan18-Oct-05 21:32 
Questionimage at runtime Pin
dhol18-Oct-05 21:03
dhol18-Oct-05 21:03 
Hi ,
I am working in c# with crystal report XI.
I read an example about dynamic image location ..

1) In that we have a xml xchema file with two fields n amed country--datatype is string, img--datatype is base64Binary. using this as the datasource,i have designed the crytal report. And a parameter is set asking for the name.

2) I have designed teh form by adding a crystal report viewer and
now the coding part is as follows


// Prcocedure: AddImageRow
// reads an image file and adds this image to a dataset table
//
// [in] tbl DataTable
// country name of a country
// filename name of an image file
//
void AddImageRow(DataTable tbl, string name, string filename)
{
FileStream fs = new FileStream(filename, FileMode.Open);
// create a file stream
BinaryReader br = new BinaryReader(fs);
// create binary reader
DataRow row;
// create a new datarow
row = tbl.NewRow();
// set country field and image field
row[0] = name;
row[1] = br.ReadBytes((int)br.BaseStream.Length);
// add this row to the table
tbl.Rows.Add(row);
// clean up
br = null;
fs = null;
}
// Function: CreateData
// Creates a dataset that has 1 table with two fields: Country (string), and img (blob/byte[])
// Adds four records to this table
//
DataSet CreateData()
{
DataSet data = new DataSet();
// add a table 'Images' to the dataset
data.Tables.Add("Images");
// add two fields
data.Tables[0].Columns.Add("Country", System.Type.GetType("System.String"));
data.Tables[0].Columns.Add("img", System.Type.GetType("System.Byte[]"));


// add rows
AddImageRow(data.Tables[0], "argentina", Directory.GetCurrentDirectory() + "\\argentina.jpg");
AddImageRow(data.Tables[0], "canada", Directory.GetCurrentDirectory() + "\\canada.jpg");

return (data);
}
// Procedure: CreateReport
// Creates a report and passes the dataset
//

void CreateReport()
{
// create a report
CrystalReport1 cr = new CrystalReport1();
cr.SetDataSource(CreateData());
// pass a reportdocument to the viewer
crystalReportViewer1.ReportSource = cr;
}

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
CreateReport();
}


This is the coding part..ie,when the program is run the image which is existing in the directory (say argentina.jpg and canada.jpg). it will ask for country name...so if we type canada..then canada.jpg wil be displyed in the report.
This is wht the program does..
No I have to modify such that .. I have to add a buttn on the form say load..so when the load button is clicked, we should be able to load any image from the disk(any location) and that image should be displayed in the crystal report..How to do this..
please if any one change the coding part above and sent it .
QuestionRetain Previous diagram Pin
nageshwa18-Oct-05 20:55
nageshwa18-Oct-05 20:55 
AnswerRe: Retain Previous diagram Pin
Wjousts19-Oct-05 2:09
Wjousts19-Oct-05 2:09 
GeneralRe: Retain Previous diagram Pin
Anonymous19-Oct-05 17:18
Anonymous19-Oct-05 17:18 
AnswerRe: Retain Previous diagram Pin
Dave Kreskowiak19-Oct-05 2:59
mveDave Kreskowiak19-Oct-05 2:59 
GeneralRe: Retain Previous diagram Pin
Anonymous19-Oct-05 17:18
Anonymous19-Oct-05 17:18 
Question64 bit or 32 bit OS ??? Pin
Md Saleem Navalur18-Oct-05 20:29
Md Saleem Navalur18-Oct-05 20:29 
AnswerRe: 64 bit or 32 bit OS ??? Pin
leppie18-Oct-05 22:11
leppie18-Oct-05 22:11 
QuestionEncoding.GetBytes Method (String, Int32, Int32, Byte[], Int32) Pin
rushing18-Oct-05 19:27
rushing18-Oct-05 19:27 
AnswerRe: Encoding.GetBytes Method (String, Int32, Int32, Byte[], Int32) Pin
Christian Graus18-Oct-05 19:33
protectorChristian Graus18-Oct-05 19:33 
QuestionWM_MOUSEUP !!!! Pin
AB777118-Oct-05 18:59
AB777118-Oct-05 18:59 
AnswerRe: WM_MOUSEUP !!!! Pin
Christian Graus18-Oct-05 19:02
protectorChristian Graus18-Oct-05 19:02 
GeneralRe: WM_MOUSEUP !!!! Pin
AB777118-Oct-05 19:07
AB777118-Oct-05 19:07 
GeneralRe: WM_MOUSEUP !!!! Pin
Christian Graus18-Oct-05 19:13
protectorChristian Graus18-Oct-05 19:13 
GeneralRe: WM_MOUSEUP !!!! Pin
AB777118-Oct-05 19:46
AB777118-Oct-05 19:46 
Questionscreenshot Pin
Anonymous18-Oct-05 18:20
Anonymous18-Oct-05 18:20 
AnswerRe: screenshot Pin
Christian Graus18-Oct-05 18:21
protectorChristian Graus18-Oct-05 18:21 
GeneralRe: screenshot Pin
Anonymous18-Oct-05 19:01
Anonymous18-Oct-05 19:01 

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.