|
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.
|
|
|
|
|
|
Unless it's your wife, you don't call anyone in the Western world "dear".
|
|
|
|
|
Your original post contains some really good answers that can help you achieve what you are trying to accomplish. But your problem is that you expect too much spoon feeding and if this is the case, you're not going to stop littering the forum by asking the same question again and again until someone writes the entire code for you for free.
People here try to teach you how to fish, but you're expecting the fish itself everytime. Pathetic.
|
|
|
|
|
Hello All,
I have used 4 textboxes & 3 dropdownlists to filter the Gridview.
Now I want to filter Pie CHART By all those same filter parameters.
Can any1 please help me for that ???
Its urgent...
Thank you in advance...
|
|
|
|
|
Hello Every one;
I'm using telerik Radeditor.When i save in the data base(SQLSERVER),i save the Content(contain HTML balises).
when i export th word document,i can't interpreat those html balise.
Best Regards,
Helmi
|
|
|
|
|
When it comes to vendor issues, you are usually better off going to their support[^] forums. Telerik has one of the finest support systems in the industry, so I would recommend that you ask your question there. Oh, and include some code when you do - they, just like us, aren't mind readers.
|
|
|
|
|
|
HiIam santhoshkumar.
Can u any body tell me How to use mvc in asp.net?
Now learning in it.
|
|
|
|
|
See here[^] for explanations and samples.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
How to set up dataGridView background image, or transparent background
|
|
|
|
|
By painting[^] it; it's not provided as default functionality.
Bastard Programmer from Hell
|
|
|
|
|
Can you provide a detailed drawing code?
|
|
|
|