|
hi,
i want to sort my windows application list view control,with out usin IComparer Class.Itried this below way.
private void Form1_Load(object sender, EventArgs e)
{
var y = from x in dcontext.CONFIG_CITies
orderby x.str_city descending
where x.bool_active == true
select new { Code = x.int_cityID, CityName = x.str_city };
int i = 0;
foreach (var lst in y)
{
listView1.Items.Add(lst.Code.ToString());
listView1.Items[i].SubItems.Add(lst.CityName);
i++;
}
int j=0;
arr = new string[y.Count()];
foreach (var asd in y)
{
arr[j] = asd.CityName+","+asd.Code;
j++;
}
}
private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
{
listView1.Columns[1].ListView.Sorting = SortOrder.Descending;
if (listView1.Columns[1].ListView.Sorting == SortOrder.Descending)
{
listView1.Items.Clear();
string[] y;
Array.Sort(arr);
string x;
int j = 0;
for (int i = 0; i < arr.Count(); i++)
{
x = arr.ElementAt(i);
y = x.Split(',');
listView1.Items.Add(y[0]);
listView1.Items[j].SubItems.Add(y[1]);
j++;
}
}
}
but it is also not working .Please help me.
|
|
|
|
|
post the error you are getting
And why don't you want to do it the standard way of using IComparer?
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
hi,
Thanq for your suggestion ,we need to sort Listview Columns without this Icomparer Class,is it possible to do without using class.
Error:
i binded two columns for listview,and if i click on second column header ,then it is displaying second column in first column.and first column is going to hide,and did n't got any error message,Please send prompt response.
Thanks & Regards,
Vishnu.
|
|
|
|
|
You posted the same question yesterday
1) Why don't you want to use an IComparer? There is nothing wrong with it and it's the standard way to do sorting.
2) Post the error message you are getting.
Perhaps then someone will answer you.
Simon
|
|
|
|
|
FtpWebRequest reqFTP;
dirName = "/dir1//dir2//dir3";
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ip + "/" + dirName));
reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
this.textBox_status.Text += WebRequestMethods.Ftp.ListDirectory;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(Username, Password);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
ftpStream.Close();
response.Close();
First, how to check the folder exist or not on the FTP?
The code can only create a directory in the path can we create multiple directory in the same time?
Thanks
|
|
|
|
|
mimimimilaw wrote: dirName = "/dir1//dir2//dir3";
What's the idea with the double slashes?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hai friends,
In my application uses a datagrid. It binds two combobox inside the datagrid. I want to display items in the second combo, when select an item in the first combo... Pls give me a solution to this.
Thanks in advance,
Praji
|
|
|
|
|
Hi,
Replacing the text in word document with the help of Programing in C# for web application.
Thank You....
|
|
|
|
|
Get it
Sathesh.
Blessed is the season which engages the whole world in a conspiracy of love.
|
|
|
|
|
I have problem with dll loading (windows says "Unable to load DLL 'Scilexer.dll', the spesified module could not be found. Exception from HRESULT : 0x8007007E).
this problem occurs when I try to override :
unsafe public override string Text
{
get
{
int sz = win32Access.SendSciMessage(directPointer,(int)ScintillaEnum.Selection.SciGetLength,0,0);
but when I change the name so that it no longer override, It can works. I can use this custom control again
unsafe public string TheText
{
get
{
int sz = win32Access.SendSciMessage(directPointer,(int)ScintillaEnum.Selection.SciGetLength,0,0);
please anyone help me to explain this.
No one can prevent me to learn something
|
|
|
|
|
Is Scilexer.dll is the same directory as the application? If so, are all Scilexer.dll's dependencies in the PATH?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Of course that dll's is in the same place. I copied that Dll into Debug and Release directory. That's why my Code work when I change unsafe public override string Text with unsafe public string TheText
Both can't work if the Dll is not in the right directory, right?
I'm still confused with this problem
No one can prevent me to learn something
|
|
|
|
|
What is the correct syntax to pass the value of index to the underlined code?
where in if index=2
XmlNodeList xmlNodes = xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[2]", tag));
Below is my code:
protected void GetItemHelp(int index)
{
string tag = Request["ref"];
string sHelpFile = Server.MapPath("~/Help.xml");
try
{
XmlDocument xmlHelp = new XmlDocument();
xmlHelp.Load(sHelpFile);
XmlNodeList xmlNodes = xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[1]", tag));
if (xmlNodes.Count > 0)
{
itemText.Text = xmlNodes[0].InnerXml;
}
else
{
itemText.Text = " [" + Server.HtmlEncode(tag) + "] Help is currently not available for this page.";
}
}
catch
{
itemText.Text = "Help is currently not available.";
throw;
}
}
|
|
|
|
|
XmlNodeList xmlNodes = xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[{1}]", tag, index));
|
|
|
|
|
Hello Navaneeth
I tried doing that but it is giving me all the items in the list. It is not getting the 2nd item.
Based on the XML below, it will display Item1.
<HelpFile>
<Help name="name2">
<Item>
<p><strong>Item1</strong></p>
</Item>
<Item>
<p><strong>Item2</strong></p>
<Item>
</Help>
</HelpFile>
Because if I will simply write this, I can display Item2
xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[2]
Any idea what am I missing?
|
|
|
|
|
Hello everyone,
I want to generate a list of all available machines on the LAN. Can anybody help me out that how can I do this?
Regards, Qaiser Nadeem
|
|
|
|
|
Why not searching for it? This[^] was my first hit when I searched in google.
|
|
|
|
|
Hello everyone,
I noticed in some code, in a derived class, the constructor will be written in a way like this, my question is whether it is good code to add base()? Because I think
- base() will be implicitly called for derived class constructor if we do not pass any parameters to base class;
- if we need to pass any parameters, I think we could declare in this way and pass parameter to base class in :base (parameters to base class constructor);
- so there is no need to declare in this way.
Any comments? Is my understanding correct?
DerivedClassConstructor():base()
{
}
thanks in advance,
George
|
|
|
|
|
When derived class is instantiated, base classes default constructor(parameterless one) will be called. If there is no default constructor available for base class, you should use base keyword to specify which base constructor has to be called. Not using base in this scenario will be a compile time error.
|
|
|
|
|
Hi Navaneeth,
1.
If there is a constructor is base class without any parameters, it should be the default constructor, correct?
2.
BTW: how to define a constructor to be default one if I have a couple of overloaded constructors?
regards,
George
|
|
|
|
|
George_George wrote: If there is a constructor is base class without any parameters, it should be the default constructor, correct?
Yes
George_George wrote: BTW: how to define a constructor to be default one if I have a couple of overloaded constructors?
You can't. There's no default constructor in this case, you have to call one yourself.
The parameterless constructor should still be the default one though.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks Greeeg,
How could I know which constructor is the default constructor?
regards,
George
|
|
|
|
|
Take a look at this link[^].
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
So, no matter the system provided constructor or the user provided constructor, if the constructor has no parameters, it could both be called default constructor?
regards,
George
|
|
|
|
|
Yes. Why don't you write a simple app and test this yourself?
|
|
|
|