Click here to Skip to main content
15,917,456 members
Home / Discussions / C#
   

C#

 
GeneralDatabinding not updating Business Object property Pin
Bert delaVega6-Dec-07 7:32
Bert delaVega6-Dec-07 7:32 
GeneralRe: Databinding not updating Business Object property Pin
darkelv6-Dec-07 16:36
darkelv6-Dec-07 16:36 
GeneralRe: Databinding not updating Business Object property Pin
Bert delaVega7-Dec-07 11:04
Bert delaVega7-Dec-07 11:04 
GeneralLINQ Question Pin
martin_hughes6-Dec-07 7:10
martin_hughes6-Dec-07 7:10 
GeneralRe: LINQ Question Pin
DaveyM696-Dec-07 8:25
professionalDaveyM696-Dec-07 8:25 
GeneralRe: LINQ Question Pin
martin_hughes6-Dec-07 10:01
martin_hughes6-Dec-07 10:01 
GeneralRe: LINQ Question Pin
darkelv6-Dec-07 14:25
darkelv6-Dec-07 14:25 
General*shakes fist at board* Pin
darkelv6-Dec-07 14:49
darkelv6-Dec-07 14:49 
Clicking the code link below posted my original reply, and I can't edit it. Frown | :(

Anyway, MatchTypes is an enum where I make use of string's StartWith, EndWith, Contains or Equals functions to filter the search string.

cmbFields contains string fields from the object.

txtValue is the value entered.

I am not able to search using wildcard though ie "ABC*"


IQueryable q = stockPositionDB.StockPositions;
if (this.txtValue.Text.Length > 0 && this.cmbFields.Text.Length > 0)
{
string s = string.Empty;
string match = ((MatchTypes)cmbMatchType.SelectedIndex).ToString();

ParameterExpression param = Expression.Parameter(typeof(StockPosition), "c");
ConstantExpression constant = Expression.Constant(this.txtValue.Text);
MemberExpression prop = Expression.Property(param, typeof(StockPosition).GetProperty(cmbFields.Text));
System.Reflection.MethodInfo mi = s.GetType().GetMethod(match, new Type[] { typeof(string) });
MethodCallExpression call = Expression.Call(prop, mi, new Expression[] { constant });
//BinaryExpression filter = Expression.Equal(prop, constant);
LambdaExpression pred = Expression.Lambda(call, param);
MethodCallExpression expr = Expression.Call(typeof(Queryable), "Where", new Type[] { typeof(StockPosition) }, Expression.Constant(q), pred);
q = q.AsQueryable().Provider.CreateQuery<stockposition>(expr);
this.bindingSource1.DataSource = q;
}
GeneralResolving a domain name to IP address Pin
Skippums6-Dec-07 7:08
Skippums6-Dec-07 7:08 
GeneralRe: Resolving a domain name to IP address Pin
Bert delaVega6-Dec-07 8:28
Bert delaVega6-Dec-07 8:28 
GeneralRe: Resolving a domain name to IP address Pin
Skippums6-Dec-07 8:54
Skippums6-Dec-07 8:54 
GeneralRe: Resolving a domain name to IP address Pin
Bert delaVega6-Dec-07 9:11
Bert delaVega6-Dec-07 9:11 
GeneralRe: Resolving a domain name to IP address Pin
Skippums6-Dec-07 10:00
Skippums6-Dec-07 10:00 
Generalformatting double value to string does not work as expected. Pin
CTaylor896-Dec-07 6:59
CTaylor896-Dec-07 6:59 
GeneralRe: formatting double value to string does not work as expected. Pin
Skippums6-Dec-07 7:31
Skippums6-Dec-07 7:31 
GeneralCheck State Pin
RussBus6-Dec-07 6:53
RussBus6-Dec-07 6:53 
GeneralRe: Check State Pin
Skippums6-Dec-07 7:14
Skippums6-Dec-07 7:14 
QuestionAccessing an instance of a form within an Application Pin
Naz6-Dec-07 6:05
Naz6-Dec-07 6:05 
GeneralRe: Accessing an instance of a form within an Application Pin
Justin Perez6-Dec-07 6:19
Justin Perez6-Dec-07 6:19 
QuestionRe: Accessing an instance of a form within an Application Pin
Naz6-Dec-07 7:25
Naz6-Dec-07 7:25 
GeneralRe: Accessing an instance of a form within an Application Pin
Bert delaVega6-Dec-07 8:14
Bert delaVega6-Dec-07 8:14 
GeneralRe: Accessing an instance of a form within an Application Pin
Naz6-Dec-07 8:34
Naz6-Dec-07 8:34 
GeneralRe: Accessing an instance of a form within an Application Pin
Bert delaVega6-Dec-07 9:18
Bert delaVega6-Dec-07 9:18 
GeneralRe: Accessing an instance of a form within an Application Pin
Pete O'Hanlon6-Dec-07 8:47
mvePete O'Hanlon6-Dec-07 8:47 
GeneralRe: Accessing an instance of a form within an Application Pin
Justin Perez6-Dec-07 9:27
Justin Perez6-Dec-07 9:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.