|
Thanks for the reply ,
May be because of the style of the text , you cant see right , I only add the columns to the listView in the first loop, then I add values to those columns..
well it seems like , the values are ok , by this code..But I guess , I made the ListView nervous , treating like a dataGrid.May be you are right, I was just looking for fun , and develop some UI skills...
<br />
StringBuilder s = new StringBuilder();<br />
foreach (ListViewItem li in this.listView1.Items)<br />
{<br />
s.Append(li.Text);<br />
for(int k =0;k<this.listView1.Items[li.Index].SubItems.Count;k++)<br />
{<br />
s.Append(this.listView1.Items[li.Index].SubItems[k].Text);<br />
s.Append("-");<br />
}<br />
s.Append("\n");<br />
s.Append("------------------------");<br />
s.Append("\n");<br />
}<br />
<br />
MessageBox.Show(s.ToString());<br />
|
|
|
|
|
ok , At last I found the reason, ColumnHeader Collection can not be work with listView(or I cant do it)
<br />
ColumnHeader [] h = new ColumnHeader[ColumnCount];<br />
<br />
for (int i=0;i<ColumnCount;i++)<br />
{<br />
<br />
h[i].Text=dTable.Columns[i].ColumnName;<br />
<br />
}<br />
this.listView1.Columns.AddRange(h);<br />
After I declare ColumnHeader one by one , it works fine..
Do you see any syntax or algorithm errors in Column Header Collection that I created?
|
|
|
|
|
it's not a collection, its an array as you have created it using array syntax.
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Because I need to use printPreviewDialog as preview only.
Pls show me the code to fix it.
Regard
Panthep
|
|
|
|
|
'Remove\Hide the print button.
Dim Strip_ToolStrip As ToolStrip
Strip_ToolStrip = Print_PrintPreviewDialog.Controls("ToolStrip1")
Strip_ToolStrip.Items("PrintToolStripButton").Available = False 'Remove
Strip_ToolStrip.Items("PrintToolStripButton").Enabled = False 'Hide
|
|
|
|
|
Thanks this approach worked, here is the code for C#
System.Windows.Forms.PrintPreviewDialog printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog();
System.Windows.Forms.ToolStrip toolStrip = (System.Windows.Forms.ToolStrip)printPreviewDialog.Controls["ToolStrip1"];
toolStrip.Items["PrintToolStripButton"].Available = false;
Thanks
Saravanan J
|
|
|
|
|
How to I can get the rows selected in dataGrid when user make muli-selection on dataGrid.
Regard
Panthep
|
|
|
|
|
For x As Integer = 0 To Me.BindingContext(Datagrid1.DataSource).Count - 1
MsgBox(String.Format("{0} {1}", x, Datagrid1.IsSelected(x)))
Next
done
|
|
|
|
|
Hi,
I'm interested in learning how to retrieve CD information from a CD Drive in C#. I really only require the volume ID, to begin with. I suppose I can learn the rest myself once I've taken the first step.
Can anyone tell me the best way to learn how to do this?
eg.
- DLL References
- Classes
- Other URLs to sources that explain this
Many Thanks!
Tim
|
|
|
|
|
Sorry, I meant TOC, not volume ID
Cheers,
Tim
|
|
|
|
|
I have the following problem: i was trying to write a simple console application where the user enters a number and the program must show that number, as you can see is VERY VERY SIMPLE! but when the user enters the number, C# takes a wrong number, and gives that as the answer, here's an example of the code:
int i=0;
console.writeline("Enter a number: ");
i=console.read();
console.writeline("Your number is {0}",i);
i don´t know what the problem is, cause as far as i know I'm using a method that works for that!
Can anybody help me, please?
|
|
|
|
|
I think you should look at the return value of console.read() method , this method is for reading the next character , for not reading an integer..
string s = Console.ReadLine();
then cast the string into an integer value
int readInt=int.Parse(s);
console.writeLine("Your number is {0}",readInt.ToString())
the above code will read the int , and then show the user...
as I know..Hope it will work..
|
|
|
|
|
how can i use the serial port and treat with it
using c# to pass characters to it
|
|
|
|
|
|
Hi,
Look at the kernel32 writefile function.
There are many examples out there on communicating with serial port.
Hope it helps.
Cheers.
Regards,
Chua Wen Ching
Visit us at http://www.necoders.com
|
|
|
|
|
I am looking to dynamically generate a value (which will be shown in a textbox) depending on which rows in a datagrid are selected, rows may be selected/deselected by the user and the value will change dynamically depending on certain fields in the selected rows. Iterating through the rows to find which ones are selected is not my dillema, the problem is that I cannot find an event that fires when a row in the datagrid is selected/deselected. I would rather not force the users to click a "calculate" button. It seems that a "RowSelected" event on the datagrid would make most sense, but I cant find any info on such functionality!! I suppose I could use the "OnMouseUp" event, but then the user would be forced to use the mouse to select rows, no shift/ctrl + arrow keys!.
Any suggestions?
Thanks,
done
|
|
|
|
|
hi friends.
can i open a closed port in c#?
i am doing an application in which i want to communicate on some ports of a target computer. i cannot find many open ports. the ports which are open are 135,139,445,1025.
how can i open a user defined port of the destination computer
|
|
|
|
|
hi there
i have a Form whit a DateTimePicker control on it
i made it custom that only the time will be display on it
like that 12:30
an i want to pass to the Sql Db only the time
how can i do it ?
thanks....
|
|
|
|
|
DateTime d = new DateTime();<br />
d=dateTimePicker.Value;<br />
d.ToShortTime();
after you pass the value into a DateTime variable , you could choose which format you would like to bind..
|
|
|
|
|
you can also do:
DateTime dtEnd = new DateTime();
dtEnd.CustomFormat = "yyyy";
this.dtEnd.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
GanDad
|
|
|
|
|
hi all.
i have a text box for input number.the user is supposed to enter a hex number.
for ex. 0800. i want to convert this textBox.Text to decimel equivalent i.e. 2048. how can i do this?
what i have done is converted the string to int using int.parse() method. but it gives me trouble if the input which is supposed to be hex is say 5b.
|
|
|
|
|
Try using
int num = Int32.Parse(string, NumberStyles.HexNumber);
|
|
|
|
|
int num = Convert.toInt32(textBox.Text)
GanDad
|
|
|
|
|
Hi,
I have an MSDOS appp that when i start by a shortcut it starts fine. When I start it by a Process.Start command it errors.
I would like it to start and run without an error. How can this be done?
Thanks for any advise.
Regards,
Stephen
|
|
|
|
|
That depends on the application and the error. What else is in the shortcut? Command line parameters? Working directory? ...
There is nothing special about launching an MSDOS process. It launches just like any other. The problem is, more than likely, you're not launching the process with the complete information the process needs.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|