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

C#

 
GeneralRe: to send data to an IP address Pin
GzMs18-Oct-12 4:46
GzMs18-Oct-12 4:46 
GeneralRe: to send data to an IP address Pin
Ravi Bhavnani18-Oct-12 4:57
professionalRavi Bhavnani18-Oct-12 4:57 
AnswerRe: to send data to an IP address Pin
Ingo18-Oct-12 6:06
Ingo18-Oct-12 6:06 
AnswerRe: to send data to an IP address Pin
jschell18-Oct-12 9:39
jschell18-Oct-12 9:39 
QuestionCan save images to a structured text file C#? Pin
Member 245846718-Oct-12 1:27
Member 245846718-Oct-12 1:27 
AnswerRe: Can save images to a structured text file C#? Pin
Eddy Vluggen18-Oct-12 1:39
professionalEddy Vluggen18-Oct-12 1:39 
AnswerRe: Can save images to a structured text file C#? Pin
BobJanova18-Oct-12 5:46
BobJanova18-Oct-12 5:46 
GeneralRe: Can save images to a structured text file C#? Pin
Member 245846721-Nov-12 16:01
Member 245846721-Nov-12 16:01 
Suppose I have the structure
C#
public struct st Staff 
        {
            public Bitmap Picture;    // Picturs 3x4
            public string FullName;   // Full name
            public DateTime BirthDay; // Bỉthday

        }


in my save button code
C#
Path = @"C:\data\database.dat";
FileStream fs;
try
{
    fs = new FileStream(path, FileMode.Create);
}
catch (Exception ex)
{
    MessageBox.Show("Error: " + ex.Message);
    return;
}

    BinaryWriter bw = new BinaryWriter(fs);


Staff = new Staff();
Staff.Picture = (Bitmap)pictureBox1.Image;
Staff.FullName = txtFullName.Text;
Staff.BirthDay = DateTime.Parse(mskNgaysinh.Text);

//ClsNhanvien Nhanvien;  // Save
for (int i = 0; i < list.Count; i++)
{
   Staff = (Staff)list[i];
   bw.Write(Staff.Picture);  // warning error: The best overloaded method match for 
                        //'System.IO.BinaryWriter.Write(bool)' has some invalid arguments
   bw.Write(Staff.FullName);
   bw.Write(Staff.BirthDay.ToBinary());
}

bw.Flush();
bw.Close();
fs.Close();

I get an error at this line
bw.Write(Staff.Picture); // warning error: The best overloaded method match for 'System.IO.BinaryWriter.Write(bool)' has some invalid arguments
I wonder in the text file can save the Bitmap type? or to switch to the new chain store? if it is correct on how?

modified 21-Nov-12 22:34pm.

Newshow to create send and receive appln Pin
jeny joseph18-Oct-12 0:10
jeny joseph18-Oct-12 0:10 
GeneralRe: how to create send and receive appln Pin
Pete O'Hanlon18-Oct-12 0:41
mvePete O'Hanlon18-Oct-12 0:41 
QuestionVariable declaration. Pin
Sibasisjena17-Oct-12 22:12
professionalSibasisjena17-Oct-12 22:12 
AnswerRe: Variable declaration. Pin
Eddy Vluggen17-Oct-12 22:40
professionalEddy Vluggen17-Oct-12 22:40 
AnswerRe: Variable declaration. Pin
V.17-Oct-12 22:41
professionalV.17-Oct-12 22:41 
GeneralRe: Variable declaration. Pin
Sibasisjena17-Oct-12 22:51
professionalSibasisjena17-Oct-12 22:51 
GeneralRe: Variable declaration. Pin
V.17-Oct-12 22:58
professionalV.17-Oct-12 22:58 
AnswerRe: Variable declaration. Pin
Pete O'Hanlon17-Oct-12 22:49
mvePete O'Hanlon17-Oct-12 22:49 
AnswerRe: Variable declaration. Pin
Shanmuga Hariharan17-Oct-12 22:55
Shanmuga Hariharan17-Oct-12 22:55 
GeneralRe: Variable declaration. Pin
Pete O'Hanlon17-Oct-12 23:22
mvePete O'Hanlon17-Oct-12 23:22 
AnswerRe: Variable declaration. Pin
BobJanova18-Oct-12 1:13
BobJanova18-Oct-12 1:13 
GeneralRe: Variable declaration. Pin
Pete O'Hanlon18-Oct-12 1:22
mvePete O'Hanlon18-Oct-12 1:22 
GeneralRe: Variable declaration. Pin
BobJanova18-Oct-12 1:36
BobJanova18-Oct-12 1:36 
GeneralRe: Variable declaration. Pin
DaveyM6918-Oct-12 22:20
professionalDaveyM6918-Oct-12 22:20 
QuestionC# setup to a sql server Pin
sc steinhayse17-Oct-12 19:13
sc steinhayse17-Oct-12 19:13 
AnswerRe: C# setup to a sql server Pin
code-frog18-Oct-12 17:57
professionalcode-frog18-Oct-12 17:57 
QuestionText to Code 128 Pin
be05x517-Oct-12 10:06
be05x517-Oct-12 10:06 

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.