|
hi ,all
a easy case,
year month day
1999 12 2
2000 8 9
2001 9 9
how can i use
listview1.Item.Add(listviewitem) ?
thanks~~~
|
|
|
|
|
Hi,
what I normally do with listview-items is to create a derived class from ListViewItem, passing the object to display to the constructor and building all subitems within a method called from the constructor.
class MyListViewItem:ListViewItem {
public MyListViewItem(DateTime dtDate):base(String.Empty) {
this.BuildItem(dtDate);
}
private void BuildItem(DateTime dtDate) {
this.SubItems.Add(dtDate.Year);
this.SubItems.Add(dtDate.Month);
this.SubItems.Add(dtDate.Day);
}
}
Then I can use objects from this class to add them to the ListView:
listview1.Items.Add(new MyListViewItem(DateTime.Now));
Look at the following link to get an idea for SubItems
http://msdn.microsoft.com/de-de/library/system.windows.forms.listviewitem(VS.80).aspx[^].
Let me know if this helps you.
Regards
Sebastian
P.S.: The code of MyListViewItem is just an example. Within the BuildItem-method you must take care of already existing subitems etc. (Be sure that the ListView is in "Detail"-View mode.)
|
|
|
|
|
Dear SeMartens,
I'm very glad to received your message,
Thank you for your advice. It is so helpful to me.
my MSN is lebron_y@126.com
and my E-mail is lebron_y@126.com ,too.
make a friend...
Regard
lincyang
|
|
|
|
|
Hi,
I want to implement kerberos authentication in an asp.net web application. This has to be done without using WSEs. Please help me out...
A sample project can help me out.
Thanks in advance!!
|
|
|
|
|
Hi,
I am using this code for downloading a file.Can anybody tell how to use it without showing save as option:-
Response.ContentType = "text/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + ViewState["Name"].ToString() + ".pdf");
Thread.Sleep(5000);
Response.TransmitFile(sfilepath);
Response.End();
Thanks
|
|
|
|
|
tauras81 wrote: without showing save as option:-
That is not possible as it is controlled by the browser.
|
|
|
|
|
Hello,
u can try out with DownloadFile() method.
for this u need to include namspace System.Net
then u can try out as
WebClient objWebClient = new WebClient();
objWebClient.DownloadFile(URI, targetfilename);
Check this hope it helps
Regards,
ashok
ashok
|
|
|
|
|
I think the above solution will solve your problem only when you are using this in a windows application.where webclient will act as intermediate browser and handle the request and target filename will be obviously a local path in your system to which you will be having access.
But if the requirement is like you have to host the webapp in a remote server and the you are accessing this website from a different client machine, there would be no choice and will be entirely controlled by the browser which you use
|
|
|
|
|
I have a DataGrid on my form that users type in numbers. The problem them I am having is that if they do not hit enter after they type in the number, that value is never set. How can I change this so its value is set without the user having to push enter?
Is it the way I am pulling the data or something else?
TixTypeQuanity = dataGridTicketTypes.Rows[dataGridTicketTypes.Rows[dgvr.Index].Index].Cells[4].Value.ToString();
|
|
|
|
|
you can set the AUTOPOST property in asp.
|
|
|
|
|
I was able to fix this as I had the datagrid set as
this.dataGridTicketTypes.CausesValidation = false;
changing this to true fix the issue
|
|
|
|
|
Text box lost focus simple solution
|
|
|
|
|
i want to read data from a serial port(where a gsm modem is connected). I want to read the reply from modem when an AT command is send to the modem.
i.e for eg. if i send AT to the modem i want to read the reply OK from the modem!
I had used the below codes but the application hangs while executing these lines:
string data = Convert.ToString(serialPort1.Read(buffer, 0, (int)buffer.Length));<br />
string data1 = Convert.ToString(serialPort1.BaseStream.Read(buffer, 0, (int)buffer.Length));<br />
I had also tried
string data = serialPort1.ReadLine();
Below is my full code section:
private void button1_Click(object sender, EventArgs e)
{
try
{
serialPort1.PortName = "COM6";
serialPort1.Handshake = Handshake.None;
serialPort1.BaudRate = 115200;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.DtrEnable = true;
serialPort1.Open();
string c = "AT+CMGS=";
string c1 = "\"+6582083412\"\r\n";
serialPort1.Write(c+c1);
string d = "Test message from coded program ";
serialPort1.Write(d);
char[] arr = new char[1];
arr[0] = (char)26;
serialPort1.Write(arr, 0, 1);
serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I would appreciate your help very much, since this is my first time i am trying to communicate with a serial port. Thanks in advance
modified on Thursday, January 15, 2009 11:48 PM
|
|
|
|
|
use the event DataReceived...
this is my email :lebron_y@126.com
we can discussion then SerialPort communications.
regards
|
|
|
|
|
Hi Aghosh Babu,
It seems like you are try to build an application which send SMS using a connect Phone , and the serial port you are using (COM6) is a virtual serial port (port used to connect to through buletooth or USB ) , so please make sure that you com6 is working , by using Apllication like Hyper Terminal (it comes with windows XP) , try to send AT , and recive OK , if its is working over there , than you can try it in your code (dont forget to disconnect hyper terminal bepore try from you code , other wise it will give error , say port already in use).
I have used the following code recive data that arrives on serial port
private static void SerialPortDataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (_serialPort.BytesToRead > 0)
{
int bytesToRead = _serialPort.BytesToRead;
byte[] dataRead = new byte[bytesToRead];
string linedata;
_serialPort.Read(dataRead, 0, bytesToRead);
linedata = ConvertToString(dataRead);
}
}
private string ConvertToString(IEnumerable<byte> ByteArray)
{
string tempStringToReturn = string.Empty;
foreach (byte bt in ByteArray)
{
tempStringToReturn = tempStringToReturn + Convert.ToChar(bt);
}
return tempStringToReturn;
}</byte>
In the above code SerialPortDataReceived is a event of serial port object , this event is raised when there data arrives on the serial port .
Try out with above information , see if it helps , i need to move now , let me know if you find any problem regarding the same
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Hi Bharat,
Thanks for the code... i am now able to read data from serial port.. initially i haven't set my handshake property properly...I used serialPort1.ReadExisting(); to read the data from serial port... i think i will redo my code with yours ...i hope your code will automatically initiate the method when a data comes into the port...
|
|
|
|
|
Gr8 to know that the code was helpful.
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Hi,
I need to take the value in label1 on form 1 and populate textbox1 on form 2. Can someone please tell me how I can go about doing this?
Thank you!
Illegal Operation
|
|
|
|
|
|
I need to display multiple lines of information on a hyperlink mouseover for a web application. The mouseover works fine, but niether " " nor "\n" works to get a linebreak into the tooltip text. Can someone please help?
Thanks.
|
|
|
|
|
|
Thanks, but no dice - Environment.NewLine.Insert(0, "sometext") does not put a line break into the Tooltip, Environment.NewLine has no effect either this thing seems bent on ignoring whitespace.
my code lokks like this:
H.ToolTip = "Date of Order: " + Convert.ToDateTime(dataread["DateStamp"].ToString()).ToString("MM/dd/yyyy HH:mm") + Environment.NewLine.Insert(0, "sometext");
|
|
|
|
|
Perhaps something like this?[^] Btw this would have been more appropriate in the ASP forum.
|
|
|
|
|
I have no idea if this actually helps you, but you are using Environment.NewLine the wrong way. It's used to insert a new line like this:
string s = "Ladies and gentlemen..." + Environment.NewLine + "Welcome to my new lair!";
Cheers,
Vıkram.
I don't suffer from insanity, I enjoy every moment of it.
|
|
|
|
|
Thanks for the pointer,
I have unfortunately come to the conclustion after trying even an ASCII carriage return that the Web Hyperlink Tooltip displays all whitespace as a single space. So, I will either have to clutter an already busy dynamic display or figure out how to get the AJAX to update just my popup panel instead of the entire page.
|
|
|
|