|
when I use openssl to generate a cert and a private key which has a password, how can I use c# to use the cert to use the cert to encrypt infomation and use the key to decode information?
|
|
|
|
|
|
|
Firstly your URI is broken.
Secondly, what does this have to do with C#?
|
|
|
|
|
Not a default control, but could easily be done using a DataGridView.
Dunno about DevExpress; you'd have to browse their products.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It's a grid of some form. You could simulate this in .NET (WinForms) with either a DataGridView, or a TableLayoutPanel, or even a ListView, or by using UserControls.
The form and contents of the grid suggest this is a "Decision Table:" [^], but that's a guess ... I can't read Vietnamese.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
I write on the winform, I'm looking for this control. It looks like a ListView with grouping functionality in use, although you'd need a bit of custom code to display the check boxes because the ListView control only supports check boxes in the first column. you have an example of this control share with me
|
|
|
|
|
Server/html controls are not real controls. Source tags stays on server side and therefore image on client side doesn't help a lot.
Instead of this you should check html source and try to reveal base engine(if possible).
As much as I know DevExpress is made for ASP.Net and ASP.Net only.
If this is DevExpress control then you MUST go to www.devexpress.com,
login and post your question there, but ...
... threre is bunch of controls in their package and what is on your picture can be achived on too many ways, so I don't think you are to lucky about this issue.
|
|
|
|
|
What are you on about? He's just asked what type of control this is. It doesn't have any indication that this is a web control.ngoj wrote: As much as I know DevExpress is made for ASP.Net and ASP.Net only You're wrong. DevExpress make controls for a wide variety of platforms.
|
|
|
|
|
Thanks, it is good to know
|
|
|
|
|
Can anybody explain to me the benefits, if any, to using var to declare stuff. I don't see the point, but it's popping up more and more. See the two examples below:
using (SqlConnection dbConnection = new SqlConnection(connString))
{
using (SqlCommand dbCommand = new SqlCommand("SELECT * FROM [TableName]", dbConnection))
{
using (SqlDataReader dbReader = dbCommand.ExecuteReader())
{
while (dbReader.Read())
{
}
}
}
}
using (var dbConnection = new SqlConnection(connString))
{
using (var dbCommand = new SqlCommand("SELECT * FROM [TableName]", dbConnection))
{
using (var dbReader = dbCommand.ExecuteReader())
{
while (dbReader.Read())
{
}
}
}
}
|
|
|
|
|
The use comes from when Linq was introduced; it will be type-safe, based on the type the IDE derives form what you put in there. It can be used both to make code more readable, and to make code harder to read.
I would also like to point out that you can simply use the factory-method on the connection to create a command; and those should not have been "var" typed, but simply the appropriate interfaces.
--edit
MSDN[^] has a better explanation than I do, ofc
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
modified 16-Sep-15 8:50am.
|
|
|
|
|
When the type is obvious, using var means you don't have to repeat the type:
var someDictionary = new Dictionary<string, List<Expression<Func<IEmployee, bool>>>>(StringComparer.OrdinalIgnoreCase);
Dictionary<string, List<Expression<Func<IEmployee, bool>>>> someDictionary = new Dictionary<string, List<Expression<Func<IEmployee, bool>>>>(StringComparer.OrdinalIgnoreCase);
When the type is not immediately obvious, but isn't integral to understanding the code, then it's a matter of personal preference or style guidelines:
using (var dbReader = dbCommand.ExecuteReader())
using (SqlDataReader dbReader = dbCommand.ExecuteReader())
(In this example, if you change the type of dbCommand , the var sample would just work, but the SqlDataReader would generate a compiler error until you changed the type of dbReader as well.)
In most cases where the type is not obvious, you should try to avoid using var :
var list = GetFoo();
List<Customer> list = GetFoo();
However, proper method and variable names would make the code clearer:
var listOfCustomers = GetListOfCustomers();
And finally, if you're using anonymous types, then you have to use var :
var listOfNames = listOfCustomers.Select(c => new { c.FirstName, c.Surname });
(Anonymous types are the reason var was introduced.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: (In this example, if you change the type of dbCommand , the
var sample would just work, but the SqlDataReader
would generate a compiler error until you changed the type of
dbReader as well.) That must be why we usually program against the base-class, putting the SqlDataReader into variable of type DbDataReader, or against its interface, IDataReader.
Declaring those as "var" means that the type may not what you expect it to be. If it offers no advantage to use var, then it might be wise to be precise.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes, please use the Interfaces.
|
|
|
|
|
It's for use with anonymous types -- where you can't know the type when you write the code.
Don't use it any other time.
|
|
|
|
|
Well said, that man.
Regards,
Rob Philpott.
|
|
|
|
|
PIEBALDconsult wrote: Don't use it any other time.
Absolute rules have absolutely no place in programming.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Good responces to all. Thanks for the feed back. So, when I see something like:
for (var i = 0; i < 10; i++)
{
}
that's just stupid.
|
|
|
|
|
In most cases, var is just a form of laziness but, in this case, replacing a three letter keyword with another three letter keyword really is bonkers (or it's a sign that they haven't customized Resharper which prompts you to change explicit types to use var).
|
|
|
|
|
Hi, I am developing a code to get name and div_id of employee from the user and then add employees name, emp_id, div_id and isTL to a List<IEmployee> where IEmployee is an interface class for Employee class.Now I want to view all the employee details from the list. And I want to edit the isTL detail of the employee which is set to false by default? How do I do? Here is my code.
class Employee
{
int div_Id;
public string Name { get; set; }
public bool IsTL { get; set; }
public Employee(string name, bool isTL, int divid)
{
this.Name = name;
this.IsGR = isTL;
this.div_Id = divid;
}
}
class Batch
{
public int AddEmployee(IEmployee employee)
{
iemplist.Add(employee);
employeeid=0;
foreach (Employee a in iemplist)
{
++employeeid;
}
}
public list<IEmployee> ViewAllEmployees()
{
foreach (Employee i in iemplist)
{
Console.WriteLine("EmployeeName: {0}", i.Name);
Console.WriteLine("IsTL: {0}", i.IsGR);
}
return iemplist;
}
}
class Program
{
static void Main(string[] Args)
{
Batch bat= new Batch();
List<IEmployee> iemplist = new List<IEmployee>();
int EmployeeId;
string name;
bool isTL;
int div_id;
case 2:
{
Console.WriteLine("enter the employee name and div_id");
name = Console.ReadLine();
isTL = false;
div_id = Convert.ToInt32(Console.ReadLine());
Employee emp = new Employee(name, isTL, div_id);
EmployeeId = bat.AddEmployee(emp);
Console.WriteLine("Employee Id = " + EmployeeId);
break;
}
case 3:
{
var s = bat.ViewAllEmployees();
break;
}
}
}
modified 16-Sep-15 3:56am.
|
|
|
|
|
"//is this correct???"
Um... no.
There are a couple of problems with your code here, and the major ones are that you don't seem to have sat down and worked out what you are trying to do before leaping into code, and that you haven't even tried to compile it. It won't compile, by the way - C# is case sensitive, so
public list<IEmployee> ViewAllEmployees() Is not the same as
public List<IEmployee> ViewAllEmployees()
When you add that the Batch class doesn't know what iemplist is because it isn't a member of the class, and that you don't define an interface IEmployee at all, it all starts to fall apart.
What it looks like is that you have grabbed chunks of code at random from the internet and chucked them into a single program and hoped it all works. That's not a good strategy - it's unlikely to work, and will take a lot more effort to bodge into doing something like the task you have been assigned that doing it yourself would have been in the first place. (It's a bit like trying to build a car by grabbing parts at random from a car breakers shelves, and trying to bolt them all together: unless the doors come from the same make and model as the chassis they just aren't going to shut properly without some serious attention from a big hammer. And then the windows won't fit either, so...)
So stop.
Copy that to somewhere safe, and start again. Look at your task, and work out what you need - and I don't think the Batch class is likely to be in that.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I suggest you get a good introductory book on C# and review the "basics." ".NET Book Zero," by Charles Petzold, is an excellent resource; it's free, and available on-line to download here: [^].
The code you show will not compile, and even your description of what the 'Employee class should be is not what it is, now. The rest of the code contains what appear to be "fragments."
You need to divide your task into specific steps, and test your work as you complete each step. Creating a method that returns a list is simple:
public List<Employee> GetEmployeesByDivision(int divisionid, List<Employee> allemployees)
{
List<Employee> empByDiv = new List<Employee>();
foreach(var employee in allemployees)
{
if(employee.div_Id == divisionid) empByDiv.Add(employeed);
}
return empByDiv;
} And, it's even easier to do using Linq, but that's for the future.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
I just want to know why the USB port still reads my mouse even if the USB ports are disabled in the registry editor and how can I completely disable it.
|
|
|
|
|
What does this have to do with C#?
|
|
|
|