|
Is it possible to filter with wildcard?
I tried:
<br />
cust_name_search = txt_custname_search.Text + "%";<br />
dataview_cust_search.RowFilter = "cust_name LIKE " + cust_name_search;<br />
It comes with error saying that "Missing Operand after Mod operation".
I know that '%' is the wildcard for Sql Command, but what wildcard do I use for dataview rowfilter, and how do I do it?
Thank you very much in advance.
|
|
|
|
|
Strings in SQL must be enclosed in single quotes.
cust_name_search = "'" + txt_custname_search.Text + "%'";
dataview_cust_search.RowFilter = "cust_name LIKE " + cust_name_search;
Also, Wildcard characters, * and %, are supported and are used with the LIKE operator. Wildcards are allowed only at the beginning and/or end of a filter string.
Regards,
Orina
http://orina.org
|
|
|
|
|
Thank you so much, it works perfectly
|
|
|
|
|
Can I actually use LIKE in row filter for interger?
For example I have these following record I want to filter:
1100
1101
1200
1201
1202
1203
1300
1301
When I typed '12' in the textbox, only record with 12 as the beginning appear (1200, 1201, 1202, 1203).
I tried:
<br />
string CustomerID = "'" + txt_customerid.Text + "%'";<br />
dataview_cust_search.RowFilter = "CustomerID LIKE " + CustomerID;<br />
But error showed up saying that I cannot use LIKE on string with integer.
Is there anyway I can do this?
Also, is it possible to filter date?
Please help.
Thank you very much in advance.
|
|
|
|
|
Does anyone know how to Filter a PKey that is a GUID? For some reason, the standard way of treating GUIDs like Strings (which works great in SQL Server) does not work on DataViews! Anyone have a Clue?
|
|
|
|
|
I have a class that serializes itself out to a file using the SoapFormatter class. I have now added a new member variable to the class and want it to be serializeable too. But loading the previously saved file fails because this new member is not available in the saved file.
If I set the new member to non-serializeable, the load works fine but then I can't save that member back out on the next save operation. Any ideas how to get around this problem without throwing my save file away and starting from scratch?
Thanks!
~Steve
|
|
|
|
|
Does your class implement the ISerializable interface? If so, you can override the ISerializable.GetObjectData method as well as the deserialization constructor to handle situations where the graph does not contain one or more fields that exist in the class.
Note that the type still needs the [Serializable] attribute even when implementing ISerializable.
Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Hey, sorry for not replying to say "thanks". I had found a solution shortly after I posted and then completely forgot that I posted! Thanks for the info... good stuff.
~Steve
|
|
|
|
|
In addition to what the 'chimp said, there's actually a better way that is verion-independent. First, if you correctly version your assemblies (as you should, just don't use automatic versioning a la an asterisk in your [assembly: AssemblyVersionAttribute] ) you'll have another problem: the serialized form won't deserialize into a newer version (the types don't match, because the versions are different).
This is where a SerializationBinder comes into play. You extend the SerializationBinder and override BindToType . This gives you a chance to "redirect" versions. What I typically do is take the assembly string (includes name, version, culture info, and public key token) and strip out everything but the version. I then concat the typename and left-over assembly name to get a version-independent type. When you then get the Type , the latest version of the assembly is loaded and the new Type is returned. This new version of your existing class would contain the new field (not "variable", which is declared within a method itself), so you may still have to use the 'chimp's suggestion of implementing ISerializable (typically a good idea when you want better control over serialization anyway).
Below is a snippet of code showing what I mentioned:
public class DiffVersionBinder : SerializationBinder
{
public override Type BindToType(string assemblyName, string typeName)
{
string name = assembly.Name.Substring(0, assemblyName.IndexOf(','));
Type t = Type.GetType(typeName + ", " + name);
return t;
}
} To use:
IFormatter formatter = new SoapFormatter();
formatter.Binder = new DiffVersionBinder();
object obj = formatter.Deserialize(someStream);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey, sorry for not replying to say "thanks". I had found a solution shortly after I posted and then completely forgot that I posted! Thanks for the info... good stuff.
~Steve
|
|
|
|
|
Hi everybody !
I'd like to create a new component : a trackbar with several scrollers on it.
I think I should modify the original component, but I don't know how to add scrollers..
I thank you for your help
fp12
|
|
|
|
|
You migth consider searching CodeProject first. There are thousands of articles and just as much sample source code. A search on slider[^] yields several good results, like Audio Mixing Console Fader/slider Control[^].
Now what exactly to you mean by "a trackbar with several scrollers on it."? Do you mean the actual track bars? The easiest way would be to wrap several TrackBar controls in a UserControl , with properties to get and set the values of each. The TrackBar control - like most controls in Windows Forms - actually encapsulate Windows Common Controls - native controls that typically let you override behavior like painting and view, but not something so vast as expanding the number of trackbars for a component. A composite control (what I mentioned above) is a much better way of doing this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hai there,
By default the the progress bar direction is horizontal. i want it to be vertical. Any idea.
And if it is not possible you are free to use some groupbox or panel (nothing else).
What i mean by the above sentance is , you can put progress bar on panel or groupbox and can rotate it.
thanks in advance
Please feel free to contact.
Sreejith S S Nair - Bangalore
|
|
|
|
|
There is no vertical attrbiute for the Progress bar. You would either have to find a 3rd party control that does what you want, or create the control yourself, extending ProgressBar.
You can't use a groupbox or panel to rotate the image of the ProgressBar. I just don't see how your going to get the ProgressBar to paint properly in this case.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
i have created a unmanaged VC++ dll and then created a wrapper class for it . i have included this wrapper class in my c# by using add reference .The function takes ushort* as the input .i.e. i am should pass a string as an input to the function
Function Prototype is this:
void WCConvertImg(unsigned short __nogc * ,unsigned short __nogc *);
now that I am facing problem in passing parameter to this function. I tried first by using unsafe in C# and then with marshal class., I cannot assign the address of string variable to ushort * variable in C#, Its not allowed in managed code .
Regards
Gobu sk
|
|
|
|
|
CppClass::Foo(System::String *s)
{
const Char __pin* name = PtrToStringChars(s);
SomeSystemFunctionW(name) //W=WIDE (UnicodeVersion)
}
That way you'll get nice interface in c# .
|
|
|
|
|
when i try using the method i get this error
(30): error C2664: 'UnManagedImgConvert::ConvertImg' : cannot convert parameter 1 from 'const __wchar_t __pin *volatile __pin *volatile ' to 'WCHAR * '
ie i cant pass name pointer as a parameter to the to the unmanaged code
|
|
|
|
|
Thanks lesnikowski,
there is an alternative in c# we can use fixed(char * a=string variable).
i got it working.
Regards
gobu sk
|
|
|
|
|
Hi folks,
can somebody tell me why TextBoxes do not render the text (assigned through the Text property) properly when using new line escape sequence like in string s = "firstline\nsecondline"; . How can I solve this?
Thanks a lot in advance!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
try using "firstline\r\nsecondline";.
|
|
|
|
|
Correct!
Thanks!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
I would suggest to use
System.Environment.NewLine
to get the right newline for the system.
Greets
Roland
|
|
|
|
|
Hi,
I've created a MDI Form and placed a button control on it.
On clicking the button, a child form will be shown.
But the button control in the parent form is shown above the child form.
Is there any way to prevent this?
Thanks.
Vipin.
|
|
|
|
|
That's not exactly the best place for child controls. The Child forms actually reside inside a control on the MDI parent, called MDIClient. You can TRY to use the .SendToBack() method of the controls in question or you could try .BringToFront() on the MDIClient control. In order to get a reference to that control, though, you'll have to enumerate the Controls collection of the MDI parent form and search for a control of type MDIClient, for it has no Name.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
Is there any way to get the exe name : "iexplore.exe" using the System.Diagnostics.Process or any other class?
Pls help me with sample cpodes, if any.
Problem is that, the code,
"processObj.MainModule.FileName" returns "explorer.exe" which is not the correct one, I think.
Cheers,
ganesh.
|
|
|
|