|
my god! it works! Thank You!
it really saves again, but I have one more question to understand how exatcly should I load the information.
lets say that I'm saving every time using the same "StringName" and only the value changes. and as I saw using the Append it does not overwrite even if it is using the same "StringName", I want to know if there is anyway to load all the values even though all of them has the same StringName of must I create StringName0 and its value, StringName1 and its value, etc.
Thanks Alot!!!
|
|
|
|
|
I use ado.net as data source for crystal report,I wanted to dynamic changed DataSet to display filter data ,I use follow code ,but It can't work,Plz help me, Thanke u.
.............
try
{
if (comboBox1.Text == "All")
strSQL = "select * from authors";
else
strSQL = "select * from authors where state ='" + comboBox1.Text + "'";
cmd = new OleDbCommand("SELECT * FROM authors",cn);
adpter = new OleDbDataAdapter(cmd);
dataset = new DataSet("authors");
adpter.Fill(dataset,"authors");
oRpt.SetDataSource(dataset);
crView.ReportSource = oRpt;
}
catch(Exception err)
{
MessageBox.Show(err.Message);
}
.........
|
|
|
|
|
I'm not sure if you are getting the error message or if you are returning your resultset. Can you directly issue your SQL statement against the database and have it return results (note your use of single quote in your SQL statement)? If you cannot get results with the use of single quotes, which generally returns only CHAR, then try:
... where state = \"" + comboBox1.Text + "\""
|
|
|
|
|
I realy want to display different report by user select filter string .
|
|
|
|
|
Can somebody tell me where i can download Visual Studio.Net 2005 Beta. Please tell me whow knwo
|
|
|
|
|
|
|
Hi, I'm creating a control, I do painting on the form and it has 1 scroll bar control, no other controls on it. I have a keyDown/keyUp handler and they work just fine until I hit the arrow keys, then the scroll bar grabs the key focus and I can't get it back. How can I stop the scrollbar from getting the key focus, I don't want it to be able to grab the key focus at all.
Thanks!
-- Rocky Dean Pulley
|
|
|
|
|
One common way of handling this sort of issue is to subscribe to the Focus events (GotFocus, LostFocus). When the focus changes, detect whether the focus fits with your plan (using the Focused property, if needed). Then, adjust the focus back to where you want it.
Of course, you'll need to test things out. It may be that the auto-adjustement of focus has side effects that will take extra effort to work around.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Thanks, but it looks like neither the UserControl class nor the VScrollBar class has these events available.
-- Rocky Dean Pulley
|
|
|
|
|
The UserControl definitely has GotFocus and LostFocus. If you are looking only in the property editor of VS, you might not see them. But, the are available if you write the code yourself: userControl.GotFocus += new ....
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
thanks, that worked.
-- Rocky Dean Pulley
|
|
|
|
|
Great!
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
I have several dataGridBoolColumn in my DataGrid. When i click inside a checkbox i want to know it's value.
First problem is that i first need to click on the checkbox in the datagrid to activate it. Then another click sets it to true then the final click put's it to false.
The three clicking option is not the biggest problem i can live with that but i need to fire an event when i change the value of a checkbox. I now have the CurrentCellChanged event but that seems a step to slow it only fires when i enter the checkbox and not when i'm clicking it on or off...
Is there an event that fires when i change to true or false ??
Hope someone can help me. Thanks in advance !
|
|
|
|
|
We can archieve it by
deriving the DataGridBoolColumn class and override the Edit method like
below:
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
object obj = this.GetColumnValueAtRow(source,rowNum);
//check if the value is DBNull,if it is, according to the
default behavior set it to false
if ( !(obj is System.DBNull) )
{
this.SetColumnValueAtRow (source,rowNum,!(Boolean) obj);
}
else this.SetColumnValueAtRow(source,rowNum,false);
base.Edit(source,rowNum,bounds,readOnly, instantText, cellIsVisible);
}
|
|
|
|
|
Thanks Alomgir, for the reply
i tried what you said and method Edit is called when i click inside the checkbox. Value is then null (i guess). Another click set's it to true but Edit method is not called when i do this. Seems like the grid is in some kind of edit mode. Only when i leave the current checkbox and return then i can see it's value is true. But when set it to false then i can only know i did that when i leave and return the checkbox.
So Edit is not called everytime i click inside the checkboxes.
Perhaps i'm doing somethig wrong dunno ?
EDIT:
so what i really need is an event which is triggered on every value change inside a checkbox no matter how many times in a row i change them.
|
|
|
|
|
Hold on please, I will send you one small sample project.
|
|
|
|
|
mgir Miahusing System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace BoolColumn
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private ArrayList dataSource = null;
private DataGridTableStyle dataGridTableStyle = null;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.InitializeDataSource();
this.InitializeGrid();
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(416, 238);
this.dataGrid1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(416, 238);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.dataGrid1});
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void InitializeDataSource()
{
dataSource = new ArrayList();
dataSource.Add(new Source());
dataSource.Add(new Source());
dataSource.Add(new Source());
dataSource.Add(new Source());
this.dataGrid1.DataSource = dataSource;
}
private void InitializeGrid()
{
this.dataGridTableStyle = new DataGridTableStyle();
this.dataGridTableStyle.MappingName = "ArrayList";
DataGridBoolColumnEx col = new DataGridBoolColumnEx();
col.AllowNull = false;
col.MappingName = "X";
this.dataGridTableStyle.GridColumnStyles.Add(col);
this.dataGrid1.TableStyles.Clear();
this.dataGrid1.TableStyles.Add(dataGridTableStyle);
}
}
public class Source
{
bool x = false;
public bool X
{
get
{
return x;
}
set
{
this.x = value;
}
}
}
///
/// Summary description for BoolColumnEx.
///
public class DataGridBoolColumnEx: DataGridBoolColumn
{
public DataGridBoolColumnEx()
{
}
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
object obj = this.GetColumnValueAtRow(source,rowNum);
//check if the value is DBNull,if it is, according to the
//default behavior set it to false
if ( !(obj is System.DBNull) )
{
this.SetColumnValueAtRow (source,rowNum,!(Boolean) obj);
}
else this.SetColumnValueAtRow(source,rowNum,false);
base.Edit(source,rowNum,bounds,readOnly, instantText, cellIsVisible);
}
}
}
|
|
|
|
|
Hi!
When i compilied my projects as release i get mscorlib.xml and xml files for all other Microsoft DLLs (like System.Drawing) that are included.
Do i need this xml files or can i delete them?
|
|
|
|
|
Who can help me tofind tools to convert from MS Access Database to MYSQL Database
I tried so hard and got so far
|
|
|
|
|
You can write a plugin in JSP or PHP which Takes all the data form ms access and first create the structure in MYSQL then transfer the data to it. Right now i don't know any tool but you can do this by using this methos. It will take hardly 2 or 3 Hours to done this work.
Try it..
Ankit Singhal
|
|
|
|
|
I want to keep a connection string in a config file in a DLL project. I have tried using myappname.dll.config and app.config and have stored the data like this...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="constring" value="a_connection_string_goes_here"/>
</appSettings>
</configuration>
and try to retrieve this data using...
strConnectionString = ConfigurationSettings.AppSettings["constring"];
I'm only getting null back. The application doesn't seem to be able to see the config file.
ConfigurationSettings.AppSettings.Keys.Count is zero.
ConfigurationSettings.AppSettings.Count is zero.
Can anyone tell me why this is not working?
Thanks in advance - Dave
|
|
|
|
|
Configuration files seems to be intended for applications, not for libraries.
ConfigurationSettings is just a wrapper around XmlDocument
You can easily write your own (and provide abstract API, so you can extend or re-implement it in case you figure out some better way how to do it).
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Because .DLL projects can't have config files.
Since the .DLL becomes part of the host application using it, any code you write like this in the .DLL will use the host applications config file.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm programming a neural network
and I got a small user interface problem.
I want it to lool like this:
Input: 10 Output: 0
The algorithm could look like this:
1. print Input:
2. get 2 chars
3. procesing
4. print Output:
5. print result of proccesing
But I can't do the get 2 chars line.
<br />
static void Main(string[] args)<br />
{<br />
NeuralNetwork nn = new NeuralNetwork(2);<br />
nn[0].addNeurons(2);<br />
nn[1].addNeurons(1);<br />
<br />
nn.CENTENIPL();<br />
<br />
educateNeuron(nn);<br />
<br />
do<br />
{<br />
setInputs(nn);<br />
nn.CalcNet();<br />
<br />
Console.Write(" Output ");<br />
for (int i = 0; i < nn[1].neurons.Length;i++ )<br />
Console.Write(nn[1][0].output);<br />
Console.Write('\n');<br />
} while (true);<br />
}<br />
static void setInputs(NeuralNetwork nn)<br />
{<br />
Console.Write("Input: ");<br />
char[] buffer = new char[nn[0].neurons.Length];<br />
Console.In.Read(buffer, 0, buffer.Length);<br />
<br />
for (int i = 0; i < buffer.Length; i++)<br />
{<br />
if (buffer[i] == '0')<br />
nn[0][i].output = 0;<br />
else<br />
nn[0][i].output = 1;<br />
}<br />
}<br />
Now it looks like:
Input: 01
Output 0,009378789
Input: Output 0,9900505
//don't worry about the decimals
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|