|
It would be very appreciate if anybody can help me.
Is it possible to pass filter condition in datagrdview.parameter to filter all the records having null value on that column
if (comboBoxOperator.Text == "xxx..") ResultFilterExpression = this.DataGridViewColumn.DataPropertyName + " LIKE '" + FilterValue + "%'";
How I can pass FilterValue as null condition .
With Many thanks
Pol
|
|
|
|
|
if (comboBoxOperator.Text == "xxx..") ResultFilterExpression = this.DataGridViewColumn.DataPropertyName + " IS NULL";
?
--edit;
Don't bump[^] your question.
Bastard Programmer from Hell
modified 24-Feb-12 19:32pm.
|
|
|
|
|
|
You're welcome
|
|
|
|
|
every body.. please help me about my problem..
i need exemple of code using c#..
how to access mySql if you made class model, class dao,,and class view.
in class model : you can make "setter getter" of your komponent,,
in class dao: you can make connection and accessing database.. "save,sellect,update,delete".
in class view : you can make some form to access mySql..
please help me..
|
|
|
|
|
Sounds like homework to me: go speak to your teacher.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
i'm sory sir.. i'm a student in high school.. so i'm just new in code to know.. jajajaajjajaajajaja.
sooo please help me sirrr
|
|
|
|
|
|
I want compress a string with Java(in Android) and decompress with c#...
I did test many algorithm.. but i cant solved my problem.
What can i do?
|
|
|
|
|
Doesn't Java support Zip[^]? .NET supports it as well. Tried it?
--edit;
Don't crosspost[^], pick a forum and stick to it.
Bastard Programmer from Hell
modified 24-Feb-12 19:27pm.
|
|
|
|
|
The important thing is to select an algorithm which is normally supported on Windows computers, like the "normal" zip suggested above. Do not use bzip, gzip and so on. After compressing with Java, save it to a file (with the extension .zip), and try to open that file with Windows explorer: when that works, the first step is succesfully completed. Then find out how to unzip it with C#.
|
|
|
|
|
Hi All
I am trying to loop through a byte array (sample below) reading the values to then insert those into a database
I loop through keeping track of the position
byte[] data;
long position=0;
while (position < data.Length)
{
position = Conversion.Extract(data, out mydata, position);
position = Conversion.Extract(data, out nextitem, position);
}
public static long Extract(byte[] message, out int variable, long position)
{
const int length = 4;
if (message.Length >= position + length)
{
variable = BitConverter.ToInt32(message, (int)position);
return position + length;
}
variable = 0;
return -1;
}
The data i have contains some null values, how can i extract these and successfully move onto the next value. At present if i come across a null value i dont know how to detect this and move onto the next item. Can anyone help at all
Thanks
Simon
6F 72 67 61 6E 69 73 61 74 69 6F 6E 49 64 3D 33
26 10 00 00 00 50 65 6F 70 6C 65 50 65 6F 70 6C
65 4C 69 6E 6B 6A 08 00 00 09 00 00 00 0E 00 00
00 53 65 6E 69 6F 72 50 65 72 73 6F 6E 49 64 0E
00 00 00 4A 75 6E 69 6F 72 50 65 72 73 6F 6E 49
64 11 00 00 00 53 65 6E 69 6F 72 50 65 72 73 6F
6E 4D 69 73 49 64 11 00 00 00 4A 75 6E 69 6F 72
50 65 72 73 6F 6E 4D 69 73 49 64 08 00 00 00 4C
69 6E 6B 54 79 70 65 16 00 00 00 50 61 72 65 6E
74 61 6C 52 65 73 70 6F 6E 73 69 62 69 6C 69 74
79 08 00 00 00 50 72 69 6F 72 69 74 79 0B 00 00
00 4C 61 73 74 55 70 64 61 74 65 64 07 00 00 00
44 65 6C 65 74 65 64 01 00 00 00 D7 0A 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 01 80 C3 29
C6 85 BF CE 08 00 02 00 00 00 3C 0C 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 F0 83 76 C6
85 BF CE 08 00 03 00 00 00 3C 0C 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 C0 0E 76 C6 85
BF CE 08 00 04 00 00 00 67 0B 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 01 70 CA 4B C6 85 BF
CE 08 00 05 00 00 00 67 0B 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 02 70 CA 4B C6 85 BF CE
08 00 06 00 00 00 9B 08 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 02 C0 BE B2 C5 85 BF CE 08
00 06 00 00 00 AD 09 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 02 10 6D F5 C5 85 BF CE 08 00
06 00 00 00 3F 0A 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 02 80 59 11 C6 85 BF CE 08 00 07
00 00 00 E3 0A 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 01 C0 D0 2C C6 85 BF CE 08 00 08 00
00 00 9B 08 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 01 C0 BE B2 C5 85 BF CE 08 00 08 00 00
00 AD 09 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 6D F5 C5 85 BF CE 08 00 08 00 00 00
C9 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 01 20 76 FA C5 85 BF CE 08 00 08 00 00 00 3F
0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 B0 CE 11 C6 85 BF CE 08 00 09 00 00 00 E3 0A
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
90 5B 2C C6 85 BF CE 08 00 0A 00 00 00 C9 09 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 20
76 FA C5 85 BF CE 08 00 0B 00 00 00 F6 08 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 01 E0 C9
D2 C5 85 BF CE 08 00 0C 00 00 00 F6 08 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 02 F0 2C C9
C5 85 BF CE 08 00 0E 00 00 00 91 09 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 01 C0 C7 EF C5
85 BF CE 08 00 0F 00 00 00 91 09 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 02 90 52 EF C5 85
SeniorPersonId | JuniorPersonId | SeniorPersonMisId | JuniorPersonMisId | LinkType | ParentalResponsibility | Priority | LastUpdated Deleted
1 | 2775 | {null} | {null} | {null} | 0 | 1 | 2012-02-22 14:31:18.200 | {null}
2 | 3132 | {null} | {null} | {null} | 0 | {null} | 2012-02-22 14:31:18.703 | {null}
3 | 3132 | {null} | {null} | {null} | 0 | {null} | 2012-02-22 14:31:18.700 | {null}
4 | 2919 | {null} | {null} | {null} | 0 | 1 | 2012-02-22 14:31:18.423 | {null}
modified 24-Feb-12 7:54am.
|
|
|
|
|
I may be misunderstanding this, but wouldn't you just check it see if variable is 0 and get the next Int32 if it was??
|
|
|
|
|
When thinking in terms of bytes (or any integral types), null and 0 are the same. In your example, when this line
variable = BitConverter.ToInt32(message, (int)position);
returns a zero, that would correspond to a null value.
|
|
|
|
|
The record in datagridview is filtered on the basis of the value selected from combobox . How I can filter the record from datagridview when the combo box selected value is null.
example : combox contain ProductGrade. So the value exists in combobox is 'A','B' and may come null value.But When I select just null value, the record is not filtering. Pls help how to filter record having null value ProductGrade
Here is the code
protected override void OnFilterExpressionBuilding(object sender, CancelEventArgs e){
base.OnFilterExpressionBuilding(sender, e);
if (e.Cancel) {
FilterManager.RebuildFilter();
return;
}
string ResultFilterExpression = "";
string ResultFilterCaption = OriginalDataGridViewColumnHeaderText ;
// object FilterValue = comboBoxValue.SelectedValue;
object FilterValue = comboBoxValue.Text;
FilterValue = StringEscape(FilterValue.ToString());
//StringEscape(FilterValue);
// Managing the NULL and NOT NULL cases which are type-independent
if (comboBoxOperator.Text == "xxx..") ResultFilterExpression = this.DataGridViewColumn.DataPropertyName + " LIKE '" + FilterValue + "%'";
if (comboBoxOperator.Text == "= Ø") ResultFilterExpression = GetNullCondition(this.DataGridViewColumn.DataPropertyName);
if (comboBoxOperator.Text == "<> Ø") ResultFilterExpression = GetNotNullCondition(this.DataGridViewColumn.DataPropertyName);
Pls Help
if (ResultFilterExpression != "") {
FilterExpression = ResultFilterExpression;
FilterCaption = ResultFilterCaption + "\n " + comboBoxOperator.Text;
FilterManager.RebuildFilter();
return;
}
string FormattedValue = "";
if (ColumnDataType == typeof(string)) {
// Managing the string-column case
string EscapedFilterValue = StringEscape(FilterValue.ToString());
ResultFilterExpression = this.DataGridViewColumn.DataPropertyName + " " + comboBoxOperator.Text + "'" + EscapedFilterValue + "'";
ResultFilterCaption += "\n" + comboBoxOperator.Text + " " + comboBoxValue.Text;
}
else {
// Managing the other cases
FormattedValue = FormatValue(FilterValue, this.ColumnDataType);
if (FormattedValue != "") {
ResultFilterExpression = this.DataGridViewColumn.DataPropertyName + " " + comboBoxOperator.Text + FormattedValue ;
ResultFilterCaption += "\n" + comboBoxOperator.Text + " " + comboBoxValue.Text ;
}
}
if (ResultFilterExpression != "") {
FilterExpression = ResultFilterExpression;
FilterCaption = ResultFilterCaption;
FilterManager.RebuildFilter();
}
}
|
|
|
|
|
You should return to your previous approach: remove the escaping of
Actually, you could use your class here, e.g.
MyClass filterValue = comboBoxValue.SelectedValue as MyClass;
And do not forget to test for NULL:
if (comboBoxValue.SelectedValue == null)
{
return;
}
|
|
|
|
|
sorry, this is the second time that i ask this
questio but i didn't get an explicit answer. anyway
If we have 2 form (Form1 & Form2) whitin a project
and we added a public object (for example textBox1)
to Form1, how can we access to value of textBox1.text
from Form2.i have done this in form2 by these codes
{
Form1 fr = new Form1();
.
.
.
}
but fr.textBox1.text doesn't show the actual value.
it just show the prdefined value of it.
please explicitly tell me how can i solve this.
|
|
|
|
|
Hello ,
In this example I will pass Textbox1.text in Form1 to Form2 TextBox1
Form1 Code :
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form2 frm2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
frm2 = new Form2();
frm2.MyVar = textBox1.Text;
frm2.Show();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (frm2 != null)
{
frm2.MyVar = textBox1.Text;
}
}
}
}
Form2 Code
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public string MyVar
{
set
{
textBox1.Text = value;
}
}
}
}
|
|
|
|
|
Hello and thanks to replied me. this is quite correct but suppose u want to
send a plenty amount of textBox and and dataGridview and.... from a Form to another,
can u tell me how can we have direct access to controls of that form. i am expert in
Delphi and there is no such a problems there. thanks agian.
|
|
|
|
|
The cleanest way to do this is by the use of delegates[^]. You create a public delegate in Form1 which Form2 can subscribe to, then when the textbox content changes, Form2 will get notified of the change and can copy the content into its own variable.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
thanks dear, but may u show me how?
give me an example by writing a short codes.
|
|
|
|
|
Try this:
public class Form1 : Form
{
public delegate void StringTransportingEvent(string value);
public event StringTransportingEvent VariableChanged;
override void OnLoad()
{
Form2 secondForm = new Form2(this);
secondForm.Show();
}
textBox1_TextChanged(object sender, EventArgs e)
{
EventHandler eh = VariableChanged;
if( eh != null)
{
eh(textBox1.Text);
}
}
}
public class Fomr2 : Form
{
public Form2(Form1 eventRaiser)
{
eventRaiser.VariableChanged += Form1_VariableChanged;
}
private void Form1_VariableChanged(string value)
{
this.TextBox1.Text = value;
}
}
It creates a custom delegate that can transport a string .
Form1 raises a custom event "VariableChanged " that Form2 subscribes to.
Ciao,
luker
|
|
|
|
|
thanks LUK, I think got it. this was a question that
had occupied my mind for many days. and u solved it
for me. thank a lot again. persons like u rich this forum.
|
|
|
|
|
If you go to the link I posted you will see a very comprehensive tutorial on the subject. While it does not answer your question directly, it is a good learning tool to help in developing your skills.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
faraz34 wrote: but i didn't get an explicit answer
Yes you did. What you didn't get was an exact code sample you could copy'n'adapt to your code. Luc's link was very explicit and explained the concepts quite clearly.
By doing this you are also making your forms completely dependant on one another. You now cannot change one form without affecting the other. This means you have a very bad data model. You shouldn't be accessing controls on one form from another. You should be putting the data from that form in a container object so that it can be passed back to or retrieved by the calling code.
|
|
|
|