|
What type of list is it? The easiest way is not to allow duplicates in the first place when populating the list by using the Contains method if your list type has one (or similar).
Dave
|
|
|
|
|
i have list[structure] named list[intpoint].
intpoint contains x and y values.
i wants the idle values of x and y. not the repeated values.
i want to remove the duplicated value of x and y in list[intpoint].
how it is possible?.
|
|
|
|
|
List<intpoint> pointList = new List<intpoint>();
if (!pointList.Contains(intPoint))
{
pointList.Add(intPoint);
}
</intpoint></intpoint>
hope will help
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
As I said avoid adding duplicates initially. This code will attempt to add Point(1,1) ten times but the list will only contain the one entry.
List<Point> listPoint = new List<Point>();
Point pointToAdd;
pointToAdd = new Point(1, 1);
for (int i = 0; i <= 10; i++)
{
if (!listPoint.Contains(pointToAdd))
{
listPoint.Add(pointToAdd);
}
}
Console.WriteLine(listPoint.Count);
If you really need to remove, I think the way is to create a new 'clean list' by iterating through the current list, checking before adding to the new list and then assigning the clean list to the old one.
List<Point> CleanList(List<Point> listPoint)
{
List<Point> cleanList = new List<Point>();
foreach (Point currentPoint in listPoint)
{
if (!(cleanList.Contains(currentPoint)))
{
cleanList.Add(currentPoint);
}
}
return cleanList;
}
Then you can simply call listPoint = CleanList(listPoint);
Dave
|
|
|
|
|
|
The free PowerCollections [^]
library has methods for this kind of thing. It's very easy to use if you're already comfortable with generic collections (which you should be if you're using .NET 2 or higher).
Kevin
|
|
|
|
|
i want develop point of sale pay roll system.please give me examples
|
|
|
|
|
hi
In a Forum we Help people Who got Stuck while Attempted to do something. You did not Attempt anything and you did not Attempt to make a reseasrch on Google on what is needed to build a POS System. please Next time Google before you ask Questions or else you will get negavite answers from other members
http://www.google.co.za/search?hl=en&q=How+to+Build+a+Pos+System+in+C%23&meta=[^]
Hope it helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
who the hell do you think you are??
we WILL NOT do your work for you! this forum is for help on specific issues you encounter, not for you to demand code.
please read THIS[^] before you post here again... then you might get a helpful answer. if you don't you'll only get shouted at again
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
i was shocked when i looked at your previous posts in this forum, so i decided to to give you some step by step pointers
1. Learn to speak English, its not my first language either, but there is nothing hard about it.
2. Get off your ass and try doing something yourself! no one here or anywhere else will do your work for you
3. Buy some programming books and read them.
4. learn some manners, don't demand that we send you code
this is guaranteed to work, you will become a great programmer if you follow this guide. but somehow i doubt that you will
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Hi
In my C#.net Inventory application in my contact us form I want to place our company website name and when clicked, it must be opened in a web page
Thanks & Regards
modified on Monday, June 30, 2008 7:29 AM
|
|
|
|
|
Hi
Take time and Explain Exacly what you want.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Add a LinkLabel in the designer or through code.
Set Text and Tag properties in the designer or in code:
linkLabel1.Text = "Code Project";
linkLabel1.Tag = "www.codeproject.com";
Add a Click event handler to your LinkLabel and in it put:
System.Diagnostics.Process.Start((string)linkLabel1.Tag);
Dave
|
|
|
|
|
I didn't think of that type of concept for the Tag property.
kudos
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi,
I have a gridview, with a rowcommand. When I try to debug I can see it dosn't call the rowCommand (DeleteImage) Please can anyone tell me, why it does not run that rowCommand?
my code:
<asp:GridView ID="grdImages" runat="server" AutoGenerateColumns="false"
AutoGenerateEditButton="false" BorderColor="Transparent"
CellPadding="2" GridLines="vertical"
CellSpacing="0" DataKeyNames="filename"
ForeColor="Black"
ShowHeader="false" onsorting="grdImages_Sorting"
onrowcommand="grdImages_RowCommand">
<RowStyle BorderStyle="Dotted" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<img src='<%#Eval("imgImage")%>' alt="Image" width="50px" height="50px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="filename" runat="server" Text='<%#Eval("filename")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button CssClass="buttonsSmall" ID="btnDeleteImage" OnClientClick="return confirm('Billedet vil ikke længere kunne vises på livesitet. Er du sikker på, du vil slette billedet?');" Font-Size="8pt" runat="server" Text="Slet" CommandName="DeleteImage" CommandArgument='<%# Eval("filename")%>' />
</ItemTemplate>
<HeaderStyle />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<RowStyle CssClass="rowcolor" />
<AlternatingRowStyle CssClass="alternatingrowcolor" />
</asp:GridView>
protected void grdImages_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "DeleteImage")
{
int imagename = Convert.ToInt32(e.CommandArgument);
string imagepath = Convert.ToString(Session["uploadpath"]);
File.Move(imagepath + '/' + imagename, Constants.ImageRecycleBin.UploadPath + imagename);
LoadImages(Convert.ToString(Session["uploadpath"]), "filename", "ASC");
}
}
Said with other words, when I hit the button in the gridview only the javascript event fires, not the RowCommand. I have tried to remove the javascript event with no success......
Kind regards,
simsen
|
|
|
|
|
DOHHHHHHH..... In my pageload event I updated the gridview without a (!IsPostBack).........
|
|
|
|
|
Hi guys,
I'm working on a c# tool to batch some compilation of different c++ projects
So evrything work fine except that I can't redirect the standard output for this command (it works for a simple dir c
For ex, this the code I use:
Process p = new System.Diagnostics.Process();
p.StartInfo = new ProcessStartInfo();
p.StartInfo.FileName = @"make.exe";
p.StartInfo.Arguments = "BUILD=release";
p.Start();
This works and open a cmd window
But I need to output the result in my c# app but when I enable the standard redirection like this
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
The process get stucked (the make process is started but it doesnt seem to do anything)
I have a do/while like this
do
{
if (!p.HasExited)
{
p.Refresh();
Console.WriteLine(" total processor time: {0}",
p.TotalProcessorTime);
}
} while (!p.WaitForExit(1000));
In fact the processor time is always null (0)
I also try these options but no more results:
p.EnableRaisingEvents = true;
p.StartInfo.CreateNoWindow = true;
Any ideas ???
Thanks in advance !
|
|
|
|
|
You are redirecting standard output.
As soon as make fills the output buffer, it will pause and wait until you read from the standard output.
So you have a deadlock there, make is waiting for your process to consume output, and your process is waiting for make to finish. You need to start reading output right away after starting the make process.
|
|
|
|
|
yeah I finally used the async method and it works:
just added my event handler on OutputDataReceived and ErrorDataReceived
thx guys !
|
|
|
|
|
Is the PATH env var set correctly?
Is the working directory set correctly?
What happens when you run this with out hiding the console, do you get the correct result?
Once you have verified the above, then start hiding the console, else you will just struggle forever.
|
|
|
|
|
hey guys...
on a form ive got 5 comboBoxes, they should all have the same data bound to them & this is how i do it
private void dataBindTimeCatComboBoxes()
{
DataSet dataSet = new DataSet();
SqlCommand selectCommand = new SqlCommand("Proc_SelectTimeCategoryName", sqlConn);
selectCommand.CommandType = CommandType.StoredProcedure;
SqlDataAdapter dataAdapter = new SqlDataAdapter();
dataAdapter.SelectCommand = selectCommand;
dataAdapter.Fill(dataSet, "tCat");
DataTable tCatTable = dataSet.Tables["tCat"];
comboBox2.DataSource = tCatTable;
comboBox2.DisplayMember = "TCat_Name_VC30";
comboBox2.ValueMember = "TCat_ID_SI";
comboBox3.DataSource = tCatTable;
comboBox3.DisplayMember = "TCat_Name_VC30";
comboBox3.ValueMember = "TCat_ID_SI";
comboBox4.DataSource = tCatTable;
comboBox4.DisplayMember = "TCat_Name_VC30";
comboBox4.ValueMember = "TCat_ID_SI";
comboBox5.DataSource = tCatTable;
comboBox5.DisplayMember = "TCat_Name_VC30";
comboBox5.ValueMember = "TCat_ID_SI";
comboBox6.DataSource = tCatTable;
comboBox6.DisplayMember = "TCat_Name_VC30";
comboBox6.ValueMember = "TCat_ID_SI";
}
the data does get bound, but the weird part is when i select a value in any one of the combo boxes ALL the combo boxes selected items change to that...
any ideas as to why? i really dont feel like making separate data sources for each one, it'll be redundant cuz all the combos have the same data.... but them sharing the same data source is the only reason that i can see for this strange behavior.
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Good Afternoon HarveySaayman
Well if you want your Combobox to Display data from one Data Source , it will be Simple, but the Behavior of Combox boxes in the Form will do , that am not sure why, but if you a for example searching based on what is selected , it will not give you a Problem, dont worry about it, i have never experienced a problem before and i understand what you mean. and if you want to bind your data fied to your Combobox, next time you can do it like this
private void dataBindTimeCatComboBoxes()
{
DataSet dataSet = new DataSet();
SqlCommand selectCommand = new SqlCommand("Proc_SelectTimeCategoryName", sqlConn);
selectCommand.CommandType = CommandType.StoredProcedure;
SqlDataAdapter dataAdapter = new SqlDataAdapter();
dataAdapter.SelectCommand = selectCommand;
dataAdapter.Fill(dataSet, "tCat");
comboBox2.DataSource = tCatTable;
comboBox2.DisplayMember = "tCat.TCat_Name_VC30";
comboBox3.DataSource = tCatTable;
comboBox3.DisplayMember = "tCat.TCat_Name_VC30";
comboBox4.DataSource = tCatTable;
comboBox4.DisplayMember = "tCat.TCat_Name_VC30";
comboBox5.DataSource = tCatTable;
comboBox5.DisplayMember = "tCat.TCat_Name_VC30";
comboBox6.DataSource = tCatTable;
comboBox6.DisplayMember = "tCat.TCat_Name_VC30";
}
Sometimes its not Necessaryto use datatable .remove that ValueMember property.
Hope it helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
create n-th(according number of your combobox) instances of DataView based on your DataTable and bind each DataView to each combobox
i hope this will help
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
worked perfectly, thanx!
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Hi guys! one question if someone can help me. I have a listview and a checkbox. When the app is started the listview is populated from one folder. When the checkbox is checked the listview is automatically populating from different folder. Now, I want when the user will uncheck the checkbox, the listview to be populated again from the first folder. Any help? Thx
|
|
|
|