|
Hi
Just do:
<br />
searchForm s = new searchForm();<br />
s.Owner = this;<br />
s.Show();<br />
now you can minimize the mainform or do whatever you want and the searchForm will do exactly what you want
greets
M@u
|
|
|
|
|
hi,
Thank you sir,
It is working..
Thanks a lot..
With regards
prasad
|
|
|
|
|
Good morning!
iam a student learning c#. Can any one tell me what is a property and whats the difference between property and method
(M.BALA SUBRAMANYAM)
|
|
|
|
|
I think property is the characteristics of a class which acts as identity of class.where as methods are various ways which class provide to manipulate its properties to provide desired result.
rahul
|
|
|
|
|
Properties control access to fields within a class:
//Field
private int number = 0;
//Property
public int Number
{
get { return this.number; }
set { this.number = value; }
}
this allows you to control wether a field can be written to or read from and can perform processing if needed.
A method contains code:
private string SomeMethod(strin input)
{
string output = input + "123";
return output;
}
|
|
|
|
|
Hi All,
I am writing a C# application and have exposed COM interfaces. This is all working. My problem is that if I start the application from the command line and then use VB to do a createobject it seems to start another instance of the application. What I want is to get a handle to the already running instance. I have looked around for some time and have not found a solution to this.
Can someone please shed some light on this?
Thanks,
Loren
|
|
|
|
|
Do you have to start it from the command line? Why can't you use CreateObject and the new instance?
VB also has a GetObject function, but your COM object has to be in the Running Object Table, and I don't know what that implies for a C# application. You could also look at Enterprise Services, i.e. COM+.
|
|
|
|
|
I have an application(C#) that is running on a piece of hardware. I then have a remote user that needs to connect to this application and control it through a COM interface. I have exposed the necessary interfaces and registered it with regasm. My problem is that when the user tries to connect to it with createobject it creates another instance. If they try and use getobject it returns an error saying "runtime error 423. File name or class name not found..."
Loren
|
|
|
|
|
Loren, I'm afraid I don't have time right now to further investigate COM+, but if you can, what I would recommend is factoring the object required by your remote client into a separate library. Then both your C# application and the remote COM client consume the library through COM+, and there you should be able to limit the instancing of your object. I'll try and find out more, but I'm sure you can as well.
|
|
|
|
|
Thanks Brad...I'll do some more investigating. Currently I am using CoRegisterClassObject(ref myGuid, myApp, ComAPI.CLSCTX_LOCAL_SERVER, ComAPI.REGCLS_MULTIPLEUSE, out myReg) which should have worked but is creating a new instance which generates a new windows form.
Loren
|
|
|
|
|
Hello all,
I am using an sql server for my application. I am creating the sql connection and modifying the database as I like.
the connection is as follows.
SqlConnection conn = new SqlConnection("Data Source=" + Environment.MachineName + "\\WINCC;Integrated Security=SSPI;Initial Catalog=Logger; Packet Size = 32766;");
the application runs perfectly fine where the sql server is installed
I want to make sure that this application runs on a machine where sql server is not installed
Keshav Kamat
India
|
|
|
|
|
How is that possible ? What do you expect to do ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What do you want to do?
If you want to connect to a database on a machine called XXXYYY every time, you will have to replace Environment.MachineName with XXXYYY. How do you expect to connect to a database that doesn't exist?
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
I suspect you are creating the SqlConnection somewhere else from where you actually need it. If you can handle not having a SQL Server installed in some places in your code, then the connection object shouldn't be known to those sections of code. What I mean is, only create a SqlConnection directly inside the code that uses it.
|
|
|
|
|
Why you posted seems like the best way to me...
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have a page that on load it connects to an access database to retrieve records. However whenever I post an event (such as inserting information into the database) I get a database unavailable (per my try/catch statement I defined) meaning that the db did not connect. I am using the same connection string to connect to the database. Another note to consider is that locally I was able to do the insert just fine.
Here's the connection string code for the onload:
//create an open string
string conString = @"Provider=Microsoft.JET.OLEDB.4.0;" + @"data source=" + Server.MapPath("/App_Data/td.mdb");
//create an open the connection
OleDbConnection conn = new OleDbConnection(conString);
conn.Open();
sql = "Select * from Guest_Book ORDER BY gb_date DESC";
OleDbCommand command = new OleDbCommand(sql, conn);
OleDbDataReader the_Reader = command.ExecuteReader();
Here's the connection string code for the posted event:
//create an open string
string conString = @"Provider=Microsoft.JET.OLEDB.4.0;" + @"data source=" + Server.MapPath("/App_Data/td.mdb");
//create an open the connection
OleDbConnection conn = new OleDbConnection(conString);
conn.Open();
sql = "Insert Into Guest_Book (gb_name, gb_email, gb_msg, gb_date) VALUES ('" + name + "','" + email + "','" + message + "','" + DateTime.Now.ToShortDateString() + "')";
OleDbCommand command = new OleDbCommand(sql,conn);
command.ExecuteReader();
Is there something that I'm missing. All suggestion welcome. Thank you.
|
|
|
|
|
I think u should try to create DSN for connection.
rahul
|
|
|
|
|
|
Hello ! Someone here, kindly help me.
I have a file Dataset1.xsd that contains 2 table adapters in one-to-many relation (tblOrder and tblOrderDetail)and Relation link of two tables throughout tblOrder.OrderID = tblOrderDetail.OrderID(of course tables contains related data in database)
I know how to use dataset to assign for Datagrid datasource to make hierachical data in grid. I assigned datagrid1.datasource = tblOrderBingdingSource.
When I run this program, then I click an item in parent data, surely child data will appear but tblOrderDetail.OrderID only appears, other columns have null values although I assigned the other columns specified values.
I don't know why so ?
Help me.
Thanks in advance
-- modified at 4:46 Tuesday 27th March, 2007
|
|
|
|
|
I'm trying to learn C# coding and I've gotten to a point where I have a question. More or less.
If you have two methods like below
public static void MethodOne()
{
result a;
}
public static void MethodTwo()
{
result b;
}
Can you use "result a" in methodTwo? I am assuming that "result a" is saved in its variable. If so what is the calling method?
Thanks for any input, its appreciated.
P.S. - Sorry about the other message with the same name. I think that I hit the wrong button.
|
|
|
|
|
JMOdom wrote: Can you use "result a" in methodTwo?
What do you mean by result a ? If it's a variable, no. It needs to be a member.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
OK, exchange "results a" and "results b" for "return a" and "return b".
|
|
|
|
|
If you return it, then you'd need to pass it as a parameter. Otherwise, it's out of scope, unless it's a member.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
To add to what Christian told you, you will have to change the return type from void to whatever a and b are.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
Its a matter of scope
If you have the following;
static int resulta = 0;
public static void MethodOne()
{
result a;
}
public static void MethodTwo()
{
result b;
result a; //Is legal
}
then result a can be referenced in MethodTwo
but if you have
public static void MethodOne()
{
int result a;
}
public static void MethodTwo()
{
result b;
result a; //Is not valid because it is not in scope
}
Hope this helps and that I understood you correctly
Mike
Everybody gotta be somebody
|
|
|
|