|
Hi Have a good day ....
I hope you will help me to solve this problem .. in my C# Windows Application Form
I have Three Froms
MainFrom -- Has Two Buttons
Btn1 Show From1
Btn2 Show Form2
---------------------
From1 Has TextBox
---------------------
From2 Has PictureBox
---------------------
- I press Btn1 , and From1 Show up ....
- I press Btn2 , and From2 Show up ....
I want , a way that when I write an image path in From1 Textbox
then Fom2 PictureBox Display it ...
I don't want to do this by timers , I wounder if there is way like delegate ? or something ?
thank in advance ...
I know nothing , I know nothing ...
|
|
|
|
|
Create a custom event in Form1 that will be fired when you get a valid path in Form1's TextBox, and have your Form2 subscribe to that event.
|
|
|
|
|
You could do it this way if you passed the instance of Form1 that you created to Form2.
|
|
|
|
|
Not necessarily. That could be done in the MainForm.
If you want to decouple your 2 forms (Form1 and Form2), you could use interfaces(possibly only one for Form1, only exposing the event).
|
|
|
|
|
True... there are a couple of options he has... these all will work.
|
|
|
|
|
You can probably do this by making an event on Form1 that basically makes the text changed event of the textbox accessable outside of the form. Then have the main form respond to the event and pass the value to form2 and call a method on form2 to draw the image. I am presenting it this way assuming that you have both forms open at the same time??
|
|
|
|
|
The easiest way is to have a custom event in Form1 that you raise when you've validated the path, passing the path as an argument in a custom class derived from EventArgs. FormMain can subscribe to that event.
Form2 should have a method, something like public void UpdateImageFromPath(string path){ }. Call that method from FormMain in the event handler for your Form1 custom event.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thank you all ..... I really appreciated every replay ....
I will try what you have said , seems there are a lot of ways
thank you ...........
I know nothing , I know nothing ...
|
|
|
|
|
|
Thank you so much, I have voted for your answer Mr.Giorgi Dalakishvili
I know nothing , I know nothing ...
|
|
|
|
|
You are welcome
|
|
|
|
|
Hello...
Are there any possibilities to use SerialPort Class for communicating with a device using RS485 ?
In google, I cannot find something, that help me.
|
|
|
|
|
It won't work with a RS485 device unless you have some converter, or some other RS485 library, to convert the signals between RS232 and RS485.
|
|
|
|
|
i want to read data from bio matrix machine
i konw the machine ip and port number
|
|
|
|
|
OK, you can use a TcpClient[^] to connect to it and the vendor's API to get the information that you want out of it. If you want more specific help post a more specific question.
|
|
|
|
|
|
I just tried it and couldn't duplicate the problem. It would appear as though you have a second control in the tablelayout, or there is something else drawing another gradient.
|
|
|
|
|
Hi..
i am using inbuilt crystal report of .net2005.
i want combobox instead of text when we ask for any parameter in discrete value window.
i am new wid this.Please help me!!
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.AnalysisServices;
using Microsoft.DataWarehouse.Interfaces;
using System.Data.OleDb;
using System.Data.Common;
namespace DatabaseApplication
{
public partial class Form1 : Form
{
string dbname;
string connectionstring;
string databasename;
string datasourceviewname;
string datasourcename;
string tableName;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string connstring = "Data Source=localhost;Integrated Security=True";
SqlConnection connection = new SqlConnection(connstring);
string query = "select * from sys.databases";
SqlDataAdapter data = new SqlDataAdapter(query, connection);
DataTable dtable = new DataTable();
try
{
connection.Open();
int records = data.Fill(dtable);
if (records > 0)
{
foreach (DataRow dr in dtable.Rows)
{
//Console.WriteLine(dr[0]);
comboBox1.Items.Add(dr[0]);
}
}
}
catch (SqlException sqlexcp)
{
MessageBox.Show("connection error");
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
dbname = comboBox1.Text;
}
private void button1_Click(object sender, EventArgs e)
{
/*databasename = dbname;
datasourceviewname = "oor";
connectionstring = "Data Source=localhost;Integrated Security=True";
//create a datasource name
RelationalDataSource newDS = new RelationalDataSource(datasourceviewname, Utils.GetSyntacticallyValidID(datasourceviewname, typeof(RelationalDataSource)));
Database db = new Database("oor");
db.DataSources.Add(newDS);
newDS.ConnectionString = connectionstring;
newDS.Update();*/
Server server = new Server();
databasename = "cwh_temp";
server.Connect("localhost"); // connection to the MS Analysis service engine
Database db = new Database(databasename, Utils.GetSyntacticallyValidID(databasename, typeof(Database)));
if (server.Databases.ContainsName(databasename))
server.Databases.RemoveAt(server.Databases.IndexOfName(databasename));
server.Databases.Add(db);
db.Update();
connectionstring = "Provider=SQLNCLI.1;Data Source=localhost;Integrated Security=SSPI;Initial Catalog=rmcwh_alevoor";
datasourcename = "ooru";
RelationalDataSource dsNew = new RelationalDataSource(datasourcename, Utils.GetSyntacticallyValidID(datasourcename, typeof(RelationalDataSource)));
db.DataSources.Add(dsNew);
dsNew.ConnectionString = connectionstring;
dsNew.Update();
datasourceviewname = "ooru";
DataSourceView dsv;
dsv = db.DataSourceViews.Add(datasourceviewname, Utils.GetSyntacticallyValidID(datasourceviewname, typeof(DataSourceView)));
dsv.DataSourceID = dsNew.ID;
OleDbConnection cn = new OleDbConnection(dsNew.ConnectionString);
tableName = "UdayPareekScale";
//dss.Tables[1].TableName = "Folder";
try
{
OleDbCommand cmd = new OleDbCommand("Select * from [" + tableName + "]", cn);
OleDbDataAdapter ad = new OleDbDataAdapter(cmd);
DataSet dss = new DataSet();
ad.FillSchema(dss, SchemaType.Source);
dss.Tables[0].TableName = tableName;
dsv.Schema.Tables.Add(dss.Tables[tableName].Clone());
}
catch (NullReferenceException nre)
{
MessageBox.Show(nre.ToString());
}
catch(Exception exp)
{
MessageBox.Show(exp.ToString());
}
//dsv.Schema.Tables.Add(dss.Tables["Folder"].Clone());
dsv.Update();
}
}
}
|
|
|
|
|
Where do you get an error? wich line?
|
|
|
|
|
|
and that line would be.....???? Notice, in your original post, you didn't supply any lines numbers!
|
|
|
|
|
i've highligthed and underlined the line that was giving me a nullreference exception.
|
|
|
|
|
then use your IDE's editor to investigate line 140 (you have turned on "display line numbers" I trust).
whatever object reference gets dereferenced (as in myObject.something) is a candidate for being null and generating said exception.
|
|
|
|
|
how to call functions like this
private void inputCheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e )
from another functions
|
|
|
|