|
I agree - mostly - in this case it was "sort of" indicated values in the area of
0- ~100. And if that's the case i would deam Dictionary excessive, otherwise I agree.
|
|
|
|
|
Homework.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Use LINQ?
var list = new int[] { 1, 2, 7, 8, 3, 5, 8, 8 };
var query = from i in list
group i by i into grp
select new
{
Number = grp.Key,
Count = grp.Count()
};
var counts = query.ToDictionary(t => t.Number, t => t.Count);
|
|
|
|
|
hi
i have a application which need a port to send data, but im in need of a utility which will tell me the availalbe ports, and whether they are opened or can they be used??
|
|
|
|
|
I think you already asked this question, didn't you? Or do you want some different information this time?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Just write the code to try opening the port. If you get an exception, it's not available.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
ya i did write a thread previously, but i couldnt find it sorry .
i only want to print statements, i dun want to open the port, when i do this method, it ends up opening the port when the port is availble
|
|
|
|
|
Hi,
My project has layered architecture. Business logic has separate project and in this project I have to use some registered OCX method.
Current situation:
In presentation layer I have window forms. It is easy to add OCX control in toolbox and draw it on any form. Object of drawn OCX control can be used for calling its methods. But I don't want to do it in presentation layer.
I have following question:
Should I manually add reference of OCX in business logic project? If yes then how I can use it in cs files?
Please tell me how to call method of OCX without having forms. That means no creation of control at design time.
Thanks.
Hassan Nisar
|
|
|
|
|
You probably need to create an interface which exposes few methods that acts like facade methods. This methods should eventually call the methods on the control. With this, your business logic project will not be aware of the OCX controls. You can inject this interface instance into your business classes from the presentation layer.
Best wishes,
Navaneeth
|
|
|
|
|
Go through these tutorials. [^]
There's nothing left in my right brain and nothing right in my left brain. |
|
|
|
|
|
you can probably do it like this...
|
|
|
|
|
hi
Is there any way i could check whether the data has been sent in serial port??
|
|
|
|
|
You really ought to learn to use search engines. I found a lot of references. Here's one, but I'll let you learn how to find more info.
http://www.dreamincode.net/forums/showtopic35775.htm[^]
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I am using the code at the botoom to generate the monthly contracts invoices and save every invoice as a separate PDF I am generating all invoices to have the same GUID so it will be easier to retrieve all but it will be more than one invoice so for example they will all have same GUID but I will have 5 or 6 companies. I want to use the same code below to generate the separate PDFs using the invoice_number as file name.
private void generate_invoices()
{
this.Cursor = Cursors.WaitCursor;
sql_connection = new SqlConnection(public_var.sql_server_connection);
try
{
sql_connection.Open();
sql_command = new SqlCommand("sp_get_account_book_by_book_guid", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_command.Parameters.Add("@book_guid", SqlDbType.UniqueIdentifier).Value = book_guid;
DataSet data_set = new dsReports();
reportTICS.Reset();
sql_reader = sql_command.ExecuteReader();
data_set.Tables[0].Load(sql_reader);
reportTICS.LocalReport.ReportEmbeddedResource = "dsReports_sp_get_account_book_by_book_guid";
reportTICS.LocalReport.ReportPath = @"C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Takhlees\Takhlees\envoice.rdlc";
ReportDataSource rds = new ReportDataSource();
rds.Name = "dsReports_sp_get_account_book_by_book_guid";
rds.Value = data_set.Tables[0];
reportTICS.LocalReport.DataSources.Add(rds);
ReportDataSource rds2 = new ReportDataSource();
rds2.Name = "dsReports_sp_get_account_book_by_account_number";
rds2.Value = data_set.Tables[0];
reportTICS.LocalReport.DataSources.Add(rds2);
reportTICS.LocalReport.Refresh();
reportTICS.RefreshReport();
if (chkSaveInvoice.Checked == true)
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
byte[] bytes = reportTICS.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
string file_path = "c:\\temp\\envoice\\" + DateTime.Now.ToString("dd MMM yyyy");
System.IO.Directory.CreateDirectory(file_path);
string file_namr = file_path + "\\" + System.Guid.NewGuid() + ".pdf";
using (System.IO.FileStream fs = new System.IO.FileStream(file_namr, System.IO.FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
}
Process.Start(file_path);
}
progressInvoice.Minimum = 0;
progressInvoice.Maximum = data_set.Tables[0].Rows.Count;
}
catch (Exception exp)
{
event_log.create_event("Problem preparing or viewing daily report." + Environment.NewLine + Environment.NewLine + exp.Message + Environment.NewLine + Environment.NewLine + exp.Data + Environment.NewLine + Environment.NewLine + exp.StackTrace + Environment.NewLine + Environment.NewLine + exp.InnerException, EventLogEntryType.Error, 9999);
MessageBox.Show("Problem preparing or viewing daily report!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Close();
}
finally
{
if (sql_reader != null) sql_reader.Close();
if (sql_connection != null)
{
if (sql_connection.State == ConnectionState.Open)
sql_connection.Close();
}
}
this.Cursor = Cursors.Default;
}
|
|
|
|
|
Hi all
How can i add a column to mydatagridview in code that the duty of this row is deleting the current row?
|
|
|
|
|
Basically you need to create a column and add it to the columns collection. As far as it's duty, I have no idea what you are talking about!
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Thanks for your help;
I mean that I want a column for deleting the current row that has been clicked;
Additionally i want a gridview that has a deleting ability and i want to add this ability to my datagrtidview in code.
|
|
|
|
|
Well, in my applications, selecting the row header and pressing the delete key deletes the row. If you need something different, then maybe using a checkbox or button column and doing the delete when that is selected would work, but it seems convoluted to me.
Or maybe I still don't understand what you want to do?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Hi,
add a ButtonColumn to DataGridView and name it like Colremove
then write code for dataGridView CellContentClick event like shown below
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1)
{
if (e.ColumnIndex == dataGridView1.Columns["dataGridView1.Colremove"].Index)
{
dataGridView1.Rows.RemoveAt(e.RowIndex);
}
}
}
modified on Friday, December 18, 2009 1:55 PM
|
|
|
|
|
I want to change skin of form with skincrafter and write below code for it but does'nt work Why?
SKINCRAFTERLib.SCSkin3Class ss = new SKINCRAFTERLib.SCSkin3Class();
ss.RemoveSkin();
ss.LoadSkinFromFile("Zondar.skf");
ss.ApplySkin();
|
|
|
|
|
I don't know, ask the people who made the library, or on their support forum if they have it?
|
|
|
|
|
Hi all,
Design question, I have three library projects, A, B and C.
Project A - error logging class
Project B - properties class with static methods
Project C - eventing class with static methods
Unfortunately, I want project A to use the properties class B, B to use the eventing class C, and C to contain an error logger object, resulting in a circular dependancy:
A <<uses>> B <<uses>> C <<contains>> A
How can I get around / redesign this? I'm a bit of a novice and might be missing the obvious but I don't see how I can use an interface, as C contains an error logging object, it is not passed an error logger as a method parameter.
Thanks in advance, am so confused!
|
|
|
|
|
Combine C & A or B & A. That's the simplest way. By combine I mean either the whole project, or just the code that relies on the other reference.
|
|
|
|
|
Combine them even though (strictly speaking) they have unrelated functionality? Thanks for your help!
|
|
|
|
|
Assuming each project doesn't really contain a single class - move the class that is offending out into a fourth project - that can then be referenced by the others as necessary.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|