|
|
With the complete lack of information you've given so far, it's IMPOSSSIBLE to answer your question.
Without seeing your code and a description of how the app works and how it's designed, there's really nothing anyone can say that will be helpful.
|
|
|
|
|
We cannot create instance of an abstract class as abstract keyword is an indication to compiler not to consider the abstract class as a type.
If any it is just for initialization of properties/variables of abstract class then that can be achieved by private or protected constructor.
If you declare a public constructor in an abstract class then compiler will not give any errors.
|
|
|
|
|
First off, you can't use a private constructor in an abstract class, as you cannot create a derived class from it: the derived class cannot access the private constructor so you get a "is inaccessible due to its protection level" error from the compiler.
And that's kind of the clue as to why you can declare a public constructor: so that derived examples can be used in any assembly or class. Yes, you could use protected instead, and that would work - but it's not so obvious that it's allowed when you quickly read it!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Varun Thakur wrote: abstract keyword is an indication to compiler not to consider the abstract class as a type. Incorrect; an abstract class is also a type.
Varun Thakur wrote: If any it is just for initialization of properties/variables of abstract class then that can be achieved by private or protected constructor. Only members need be initialized, and one doesn't need a constructor for that either.
Varun Thakur wrote: If you declare a public constructor in an abstract class then compiler will not give any errors. Sound correct. Same does not apply to private methods btw.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have a form in which i an using tab control.
There are three tabs and in each tab there are textboxes.
What i want to achieve is that when i switch from tab 1 to tab 2. All the textboxes of tab 1 should be cleared.
Is it possible???
I am using Visual studio 2013, .NET 4.5, C#
|
|
|
|
|
Check the active index of tab on tab click and set the text box blank.
|
|
|
|
|
Thnx... I did consider your suggestion and used tab Deselecting event....
Thnx again...
|
|
|
|
|
Why the following code gives me this:
1000000000000000019884624838656
instead of
1000000000000000000000000000000
BigInteger result = new BigInteger(Math.Pow(1000, 10));
|
|
|
|
|
|
|
excuse me are you from iran
|
|
|
|
|
|
I am trying to use Lognormal distribution in one of my projects and require the inverse Cumulative distribution function.
Any help would really be appreciated
|
|
|
|
|
|
Thank you Richard, I was not looking for a code. using lognormal means that I need to use the inverse of an ERF or ERFC. I know that both are implemented in c#, and was merely looking for some help in directing my search.
|
|
|
|
|
|
This form search in one table (Name,Address,Age)
Name| operate | value
Address| operate | value
Age | operate | value
Ex:
Name | = | JON
Address| like | New
Age | between | 18 50
Please help me the best solution for this problem
|
|
|
|
|
select * from tablename where
name = 'JON' and
address like '%New%' and
age between 18 and 50
|
|
|
|
|
Thanks Guy,
This problem is difficult. User can select the operator ">" or "<" or "between" ,...- not fix.
After user select some operator and input some values, we will create sql query
|
|
|
|
|
Peter Leow supplied the script here is some more
Create a form with 3 text boxes a button (Search) and a grid.
when the user clicks the search button trap the event and
make a connection to the database
pass in the query based on the data entered into the textboxes (using PLs query example)
get the dataset from the sql command object
bind the datatable to your datagridview
Improve the query by using parameters - see "Little Bobby Tables"
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks Guy,
This problem is difficult. User can select the operator ">" or "<" or "between" ,...- not fix.
After user select some operator and input some value, we will create sql query
|
|
|
|
|
Create a class Criterion with 4 string properties: Name, Operation, Value, SecondValue - yes, the SecondValue is required in such rare case like that "between". Also create a collection class for it, e.g. Criteria:List<Criterion> .
The most complicated part is the ToSQL() of Criterion. In many cases, simple concatenation will suffice.
Then start your query with
string query = "SELECT * FROM MYTABLE WHERE 1=1 "
then simply iterate thru the collection and add
query += " AND " criterion.ToSQL();
Well, that is still open to SQL Injection. Update the ToSQL function and do another loop to add the parameters then (next step - doing it in one step is surely still beyond your level, but with two steps, you could do it).
|
|
|
|
|
thank your comment. i will try with this solution
|
|
|
|
|
My funtion done:
private void radButton1_Click(object sender, EventArgs e)
{
string query = "SELECT * FROM Mytable WHERE 1=1 ";
if (txtValue1.Text.ToString()!= "")
{
query += " AND " + OpeReturn(FullName.Name.ToString(), cboOpe1.SelectedIndex.ToString(), txtValue1.Text.ToString());
}
if (value2.Text.ToString() != "")
{
query += " AND " + OpeReturn(TotalAmount.Name.ToString(), cboOpe2.SelectedIndex.ToString(), value2.Text.ToString());
}
query.ToString();
SearchContractBindingSource.DataSource = RemoteClient.remoteData.QueryHopDongBan(query);
}
private string OpeReturn(string field, string ope, string value)
{
switch (ope)
{
case "0":
return field + " like " + "'%" + value + "%'";
case "1":
return field + " not like " + "%" + value + "%";
case "2":
return field + " like " + value + "%";
case "3":
return field + " like " + "%" + value;
case "4":
return field + " = " + value;
case "5":
return field + " != " + value;
case "6":
int index = value.IndexOf(" ");
string value1 = (index > 0 ? value.Substring(0, index) : "");
string value2 = (index > 0 ? value.Substring(index + 1) : "");
return field + " > '" + value1 + "' AND " + field + " < '" + value2 + "'";
case "7":
return field + " > " + value;
case "8":
return field + " >= " + value;
case "9":
return field + " < " + value;
case "10":
return field + " <= " + value;
default:
return " 1 = 1 ";
}
}
Thank All!
|
|
|
|