|
Hello friends;
I am writing in a listview data from an array. It is listed by the checkbox for each data alone. I would like to add by selecting a different TextBox. It's ip address in the TextBox.
in the textbox:
111.99.1.100
in the listview :
/xxx.asp?name=EMMA&Surname=ALIYEVA&SNumber=00121214512&RDate=2012.07.04
/xxx.asp?name=ANNA&Surname=MARIA&SNumber=00121334512&RDate=2012.07.03
etc.
i want - for example :
I chose the first record.
111.99.1.100/xxx.asp?name=EMMA&Surname=ALIYEVA&SNumber=00121214512&RDate=2012.07.04
#listview #checkbox #post #send c#
p.s. I'm sorry for my english sucks.
|
|
|
|
|
You may have better luck if you posted this in the ASP. NET forum[^]. If you do so, please edit your post and mark it as [Moved] so you don't get flamed for crossposting.
/ravi
|
|
|
|
|
I'm working, I'm in visual studio C# # Windows Forms application. This study is not web application.
|
|
|
|
|
OK, then this is the correct forum. But I still don't understand your problem.
/ravi
|
|
|
|
|
Do you want to send data to another computer with a given IP-Adress?
Well for the take a look at socket-programming:
Sockets in C#[^]
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
If I understand the question.
1. Learn how TCP and sockets work.
2. Write code to send a message via a socket.
3. Write code to receive a message via a socket.
4. Create a message that contains the data above. Note that the message contains it. It is not just the data.
5. Put all of the above together to solve your problem.
Note that steps 1-4 have NOTHING to do with GUI elements of any kind. So your code for 2-4 must not have any text boxes, nor list views nor check boxes.
|
|
|
|
|
Suppose structured
public struct stNhanVien
{
public WhatType? Picture;
public string FullName;
public DateTime BirthDay;
}
Can save images to a structured text file (note: do not store the path of the image), to save the image of the structure of text files will have style? one example of this?
|
|
|
|
|
Yes/no. "Saving" objects (and structs) is done via a technique called serialization[^]. The buil-in classes can serialize to Xml, or binary - and you can plugin your own format, if required.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
A 'structured text file' usually means fixed record length. That's not good for storing variable length data, like images.
However what you've posted there is a non-fixed-length structure. So I'm not quite sure what you're trying to do. Dumping a list of that struct to file would be 'structured', but not a 'text file'.
The Image class[^] is serialisable, so if you're using serialisation to persist and restore data, then you can just put an Image (or an Image subtype, e.g. Bitmap) into your struct.
|
|
|
|
|
Suppose I have the structure
public struct st Staff
{
public Bitmap Picture;
public string FullName;
public DateTime BirthDay;
}
in my save button code
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);
for (int i = 0; i < list.Count; i++)
{
Staff = (Staff)list[i];
bw.Write(Staff.Picture);
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.
|
|
|
|
|
|
Errrm what? There seems to be a missing question there. Is it hiding behind the smiley? Tell it to come out so we can all have a go.
|
|
|
|
|
Which is the better place to declare variable ?
1>Inside try block
2>Outside before try block
|
|
|
|
|
Sibasis jena123 wrote: 1>Inside try block
2>Outside before try block
Based on theory, I'd say that it needs to be within the block, to limit it's scope as much as possible.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
if we want that variable inside the catch or final block we have to declare out side the try block .
If we want it only in try block then variable should be declared inside try block .
|
|
|
|
|
asuming you mean
if we want that variable outside the catch or final block we have to declare out side the try block .
If we want it only in try block then variable should be declared inside try block .
yes
|
|
|
|
|
The answer is that it really depends. If your variable doesn't need to be seen in the catch or finally block, and doesn't have scope that extends beyond the try/catch/finally block, then scope it inside the try part. If its scope can't be limited then you have no choice other than to declare it outside.
|
|
|
|
|
It depends on the usage , if we need our variable needed in catch then declare it outside else declare it inside the block
HariHaran.
Enjoy coding
|
|
|
|
|
That's not the whole answer. The correct answer is that if the variable will only ever be used in the try part, then you can declare it there - if it needs to exist in the catch, finally or outside the scope of the exception handling, then it has to be declared outside.
|
|
|
|
|
Variables should always be defined in the tightest scope that they are needed for. This is an extension of the principle that says you should have class instance variables not static or global ones, and that you should have function/procedure local variables not instance ones.
So if the variable's only used inside the block, declare it inside. That's true whether it's a try, an if, a while or whatever.
You can even scope sections of code simply to create a localisation region, e.g.
void SomeMethod(){
{
int a = 1;
Console.WriteLine(a);
}
{
string a = "test";
Console.WriteLine(a);
}
}
That is not generally something that people recommend, though.
|
|
|
|
|
BobJanova wrote: You can even scope sections of code simply to create a localisation region
Indeed, and whenever I've seen this done, this tells me that the method should have been split into separate methods.
|
|
|
|
|
The only time I've done something which is technically that is scoping case: blocks in a message dispatching switch. (It's in the game lobby library that I posted on here, I think.) A true short method fundamentalist would have each case do nothing but call a method to handle the individual case, but I'm not one of those.
Yeah, generally it's an indication of muddled thinking and that something is actually two separate operations.
|
|
|
|
|
BobJanova wrote: in a ... switch
That's the only occaision I've ever needed it too
|
|
|
|
|
I have a question about setting up permissions on a sql server 2008 r2 datbase.
I basically wrote and enhanced some C# 2008 and C# 2010 console applications that connected to my test sql server 2008 r2 database. On my test database, I must all full right my default.
My 3 applications were deployed to a user acceptance testing environment that includes a user acceptance sql server 2008 r2 standard database.
The user accpetance database was set up by the network administrator at my small company. He is the only one at my small company that knows a little bit about the dba roles and has locked down permissions.
Due to the facts above, I would like to know what should I be aware that may need to have permissions setup for. My questions includes the followinng:
1. When to decide if role(s) need to be setup and how to setup the roles. When I ran my applications on my test database, I had the integrated security set to true. I did not need to supply the user name and password in the connection strings to the database. My user account was setup to have a role in the database.
Due to what I just said, will I need to have setup roles for the console applications to run on their own? If so, What kind of roles need to be setup and how do you setup these roles?
2. I setup 3 new tables that are under the dbo schema. Do I need to have permissions setup so people and/or roles can have read, write, update and/or execute permissions? If so, how do you setup these permissions?
3. I have also created 2 stored procedures that are used to access the 3 new tables that I setup. Thus do these stored procedures need to have read, write, update and/or execute permissions on them setup?
4. Do statistics (explain plans) need to be run on this database that has hardly evern been used before? If so, how do you accomplisth this goal?
5. Are there other items I need to consider? If so, what are the items and what do I do to resolve those issues?
If you can any part of my questions above, I would appreciate hearing what your answer is also.
|
|
|
|