|
If your trying to combine 2 wrod doc's it's not that simple.
Word docs use Structured Storage[^] (aka DocFile[^]) for pre 2007 files.
For 2007 there is a new XML format ... you can do your own google for that :P
Either way you cannot simply concatenate these documents.
|
|
|
|
|
thanks for all your help.
I found how to resolve my problem(with tx textcontrol).
Thanks again.
Regards,
WhiteGirl23
|
|
|
|
|
I have a list box with some items.
my code snippet:
foreach(string item in listbox1.items)
{
// some code
}
it gaives an exception:
Unable to cast object of type 'System.Drawing.Point' to type 'System.String'.
which is in the first line i.e string item
help me with an alternative way
|
|
|
|
|
listbox1.items returns a ListItemCollection (you must use System.Collections), it doesn't return a string array.
foreach(ListItem item in listbox1.items)
{
string sText = item.Text;
string sValue = item.Value;
// some code
}
Regards.
Just call me Valy...
|
|
|
|
|
Thanks for the suggestion...
But when I use
foreach(ListItem item in listbox1.items)
{
}
It throws an exception saying ListItem is not a type or namespace
are u missing a assembly reference or an using directive
|
|
|
|
|
sangramkp wrote: are u missing a assembly reference or an using directive
Well, Are you?
ListItem is in the System.Web.UI.WebControls namespace. It is probably the 'using' you are missing rather than the assembly reference.
|
|
|
|
|
But I am working on windows Application...
|
|
|
|
|
But i am working on a windows forms application
|
|
|
|
|
Hi,
a ListBox item can have any type you choose, all the items in a ListBox
dont even have to have the same type.
Foreach insists that each item in the collection has the indicated type,
otherwise an Exception will be trown.
If the types differ and you want to process only one of the types, say you
only want to process the strings, then do the following:
foreach (object item in collection) {
string str=item as string;
if (str!=null) {
.. handle the str
}
}
|
|
|
|
|
Hi pattyn
While i am trying to use
foreach(ListItem item in listbox1.Items)
{
}
It shows an error:
Error 1 The type or namespace name 'ListItem' could not be found (are you missing a using directive or an assembly reference?)
|
|
|
|
|
So ?
I never told you to use the ListItem class, did I ?
|
|
|
|
|
I really like your sig XD
|
|
|
|
|
Thanks.
I devised it to encourage people to search CodeProject before asking
simple questions for which the answers are readily available...
|
|
|
|
|
Except it hasn't worked in this case
only two letters away from being an asset
|
|
|
|
|
Yeah, what would we do without simple questions ?
We would have to investigate the hard ones !?
|
|
|
|
|
Hi,
I am trying to insert selected items from a listbox into a label, the listbox is fillby a database query, the problem is all I get is this System.Data.DataRowView it works fine when I dont use a database query and just text in the listbox.
Cant anyone help on a solution for this??
Dim i As Integer<br />
For i = 0 To ListBoxUpgrade.Items.Count - 1<br />
If ListBoxUpgrade.Items(i) Then<br />
LabelSum.Text = LabelSum.Text & Space(6) & ListBoxUpgrade.SelectedItem(i) & vbCrLf<br />
End If<br />
Next i
Thanks in advance!
Stefan.
"All answers have a question? All code has an end."
|
|
|
|
|
I don't use VB very much but from what I know in C# if you use something like
ListBox1.SelectedItem[i] it would not work.
ListBox1.SelectedItem[i] returns a ListItem this one has a Text and a Value property.
I think you should use something like ListBoxUpgrade.SelectedItem(i).Text
Hope it helps...
Just call me Valy...
|
|
|
|
|
You must select a column index for the DataRowView. Try this:
<br />
for(int i=0; i<ListBoxUpgrade.Items.Count-1; i++) {<br />
if(ListBoxUpgrade.Items[i].IsSelected) {<br />
LabelSum.Text += " " + ((DataRowView)ListBoxUpgrade.SelectedItem[i])[yourIndex] + "\r\n";<br />
}<br />
}<br />
____________________________________
There is no proof for this sentence.
|
|
|
|
|
you would be better of posting this in the VB forum instead of the C# forum...
|
|
|
|
|
Thanks,
Sorry I thought I had!
My bad.
"All answers have a question? All code has an end."
|
|
|
|
|
no worries, if you browse long enough trhough CP you can tell the difference between people making a mistake and people just being lazy .
There is no bad in making a mistake, it makes us human .
|
|
|
|
|
Hi,
In windows application - I want the user to press a button
and while the button is pressed I will do something...
I tryed the mouse down event but it only doing it once
and I want to do the same function as long as the button is pressed (or the mouse button is down)
Thanks
dana Tov
|
|
|
|
|
On the mouse down event start a new thread that does the work. On the mouse up event signal the other thread to stop working.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Thanks!!
Is there a way to do it in a single thread?
dana Tov
|
|
|
|
|
Hi,
a keyboard key has autorepeat, so it will generate multiple KeyDown and KeyPressed
events when you hold the key down. A mouse button does not.
If you need a repeat for the mouse button (or a faster repeat for a keyboard key)
you can use a Forms.Timer that runs all the time, and checks whether the ccndition
is satisfied (either key is down or mouse button is down).
For "key is down", set a variable lastKey to the key that is down in KeyDown,
and set it to Keys.None in KeyUp; for "mouse is down" use Control.MouseButtons
(there also is Control.ModifierKeys for CTRL/ALT/SHIFT).
|
|
|
|