|
eyalbi007 wrote: Is it clearer now?
Yes.
Well, actually I made a similar test and it works fine on my system.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
eyalbi007 wrote: current situation: lvwMyListview.TopItem.Index == 44,
lvwMyListview.Items[47]==lvwMyListview.Items[44] would be sufficient to get such result...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Working with automatically assigned indexes can be unreliable if controls are being updated as the index will change on each update.
The solution is: as each item is created, give them a unique id of your own and put it in the tag property. Make sure that the item's id will ALWAYS be the same. Before updating the list view, store the required item's tag value - (int)Tag (the Tag holds an object so will need casting).
When updating the list view, as each item is added, check if its id is the same and store the index that is auto-assigned to it. Then, after the update is finished, use the EnsureVisible method on that item's index.
|
|
|
|
|
Thank for the quick reply,
As I've mentioned - I'm not mistaken while indexing - the indices are correct and as you suggested, if there's a chance of order mix up I determine them using other properties.
Thanks.
|
|
|
|
|
I have binded a textbox control with database column, I want to remove that binding in runtime. How to write the code for remove function?
|
|
|
|
|
Try this
textBox1.DataBindings.Remove(textBox1.DataBindings["Text"]);
(I am not pretty sure about this...)
or you can clear all the databindings like this
this.textBox1.DataBindings.Clear();
*jaans
|
|
|
|
|
but these two are not working.......
|
|
|
|
|
Hi friends how can i upload my files to net.
Server Error in '/test' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'Default'.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File: F:\hshome\atslserv\mssql.atsl.in\test\Default.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407
this is the error what i receive during uploading process.
Hi,Im Razana
|
|
|
|
|
Compile the application before you try to run it.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
I want to change the system date style formate not by regional setting in control panel.
Help me out.
|
|
|
|
|
Why would you want to do this? There's normally a reason that these are set to the value they are, and it's bad practice to come along at a later stage and change the settings that somebody or something else has set in the first place. If it's purely to support a different date style in your application, you can always use one of the various DateTime converters.
|
|
|
|
|
Yeah, what he said; it's user hostile.
|
|
|
|
|
I want to add an Icon image to a dll in runtime.
How can i do this plz hit?
Thanks i advance.
|
|
|
|
|
Without recompiling it there is no easy way to accomplish this.
|
|
|
|
|
<Clips>
<clip name="smoking.mp4" id="1" type="d" />
<clip name="smoking1.mp4" id="1" type="d" />
<clip name="divorce.mp4" id="2" type="d" />
</Clips> I have the above XML file. Which is the best and efficient way to get all "CLIP" nodes which have id="1". I am not able to use LINQ here as I am doing this in C# 2.0. Any suggestions ?
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();<br />
xmlDoc.Load(@"myfile.xml");<br />
XmlNode clipsNode = xmlDoc.SelectSingleNode("/Clips");<br />
foreach(XmlNode clipNode in clipsNode.ChildNodes)<br />
{<br />
XmlAttribute nameAttr = clipNode.Attributes["name"];<br />
XmlAttribute idAttr = clipNode.Attributes["id"];<br />
XmlAttribute typeAttr = clipNode.Attributes["type"];<br />
<br />
Console.WriteLine(nameAttr.Value);
Console.WriteLine(idAttr.Value);
Console.WriteLine(typeAttr.Value);
}
|
|
|
|
|
Thanks. I was going through XPathNavigator documentation which looks more efficient. What do you think ?
|
|
|
|
|
The code is similar. Just use SelectNodes instead of SelectSingleNode, and use an xpath expression that selects the nodes you want instead of selecting the parent node.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Thanks Guffa. I have tried XPath and it successfully worked with XPathNodeIterator . But it don't have any methods which can return the current node. So I did that in the following way, is any other method available other than this ?
while (iterator.MoveNext())
{
if (iterator.Current is IHasXmlNode)
{
XmlNode xNode = ((IHasXmlNode)iterator.Current).GetNode();
objList.Add(xNode);
}
} This code gives me a collection of Nodes got from the iterator. Any other efficient method for this ?
|
|
|
|
|
Ok, since you are asking for efficient code
N a v a n e e t h wrote: if (iterator.Current is IHasXmlNode)
{
XmlNode xNode = ((IHasXmlNode)iterator.Current).GetNode();
objList.Add(xNode);
}
is operator looks up type of iterator.Current and checks if it is of type IHasXmlNode or derived, and returns true or false.
Cast does the same lookup and check, only it returns IHasXmlNode or throws invalid cast exception.
For this pattern there is as operator, which does the same check, and return IHasXmlNode if it succeeds or null if it fails. One null check is faster then type lookup & check. While it is possible that JIT recognizes this pattern and optimize your code anyway, I wouldn't bet on it
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
dnh wrote: For this pattern there is as operator, which does the same check, and return IHasXmlNode if it succeeds or null if it fails. One null check is faster then type lookup & check.
That's good. That's a new information for me. Thanks
|
|
|
|
|
hi all i'am beginner in .net anybdy can u help me how to create connection to oracle or sqlserver 2000 with using by C#...?
thank's
biengupta
|
|
|
|
|
|
ok, thank's a lot!!
|
|
|
|
|
Hello frnds,
i am reading a Xml file using XmlReader,code is
XmlTextReader rdrXml = new XmlTextReader(strFilename);
xmlElement XmlEle = new xmlElement();
switch (rdrXml.NodeType)
{
case XmlNodeType.Element:
//here i want to store the Element in
saparate Element Variable like
XmlEle = rdrXml.LocalName
break;
}
The BOLD line gives me error..
where i am wrong ...i want to get the parent Name of that XMLElement
how can i do that???
please help...
Thankx in advance
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|