|
Message Closed
modified 27-Apr-15 11:03am.
|
|
|
|
|
Did you actually try to adapt what I gave you in my first post. It's not that hard:
on form1 :
if ((textBox1.Text == "admin") && (textBox2.Text == "xxx"))
{
Form2 mehmet = new Form2();
mehmet.FormClosed += new FormClosedEventHandler(this.Form_FormClosed);
mehmet.Show();
this.Visible = false;
}
...
void Form_FormClosed(object sender, FormClosedEventArgs e)
{
this.Visible = true;
}
Nothing to do on form2
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Yes... you must have a reference of form1 in form2.
If you create form2, you must edit the constructor of form2.
Form1 form1 = null;
public Form2(Form1 form1)
{
this.form1 = form1;
}
private void form2_Closed(object sender, EventArgs e)
{
this.form1.Visible = true;
}
And then in form1, if you create the form2, you must use this code :
Form2 form2 = new Form2(this);
form2.ShowDialog();
|
|
|
|
|
If you have a reference of form1 in form2, you can call anything in form1, but you must set the method/property in form1 to PUBLIC.
There are 2 possibilities, whether you create a new property or set your textbox to public.
e.g.
public string MyTextbox
{
get { return this.textbox.Text; }
set { this.textbox.Text = value; }
}
private void ChangeTextInForm1()
{
this.form1.MyTextbox = "Hello World Again";
}
|
|
|
|
|
How to throw soap exception. Can u give an example
ItsMe
|
|
|
|
|
Just throw any exception in the web service. It will be sent as a soap exception to the caller.
---
b { font-weight: normal; }
|
|
|
|
|
No if i tend to access this web method in windows application i wont get the error in soap class. i need to explicitily specify using soap exception class i think
ItsMe
|
|
|
|
|
I've got something like this
String[] thing = {"name", "number"}
int count = 0
for (count < 3; count++)
{
String command = "this." + thing[count];
command = input.readline();
}
this.name and this.number are datatypes I've created and need to dynamically get access to to create entries. Unfortunatly I dont know how to get c# to use command literally, rather then just overwrite the string.
Anyone got this figured out? Thanks!
|
|
|
|
|
Reflection is your friend:
for (int count = 0;count < thing.Length; count++)
{
FieldInfo info = this.GetType().GetField(thing[count], BindingFlags.NonPublic);
info.SetValue(this, input.readline());
}
Note that with BindingFlags.NonPublic I assume that both variables are declared private. If not, take a look at the help for the GetField method and the BindingFlags enumeration and you should be able to figure out what needs to be changed.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Hi folks.,
i have capture the live video by using DirectX.Capture application (got from Codeproject) but now i have a problem with Auto Tuning channels.
is there any one face like this plz share with me.
Thanks & Regards
ranandbe
|
|
|
|
|
The DirectShow.NET managed library on SourceForge recently completed all their planned interfaces for DirectShow. I suggest you get this, the article on here on CP is likely outdated.
|
|
|
|
|
Can any one help me out, I am trying to run a seperate thread from my main thread to perform some functionality, my problem is I am trying to open a modal dialog from my child thread, even I use Form.ShowDialog() method this is behaving as modeless and it is allowing access to other screens in the mdi which should be restriceted. Any help would be appreciated
Regards,
Krishna
|
|
|
|
|
You should not be creating controls on other threads. Use Control.Invoke() from you worker thread.
|
|
|
|
|
To substantiate Leppie's post, when you call ShowDialog on a thread other than the UI thread, it essentially behaves as a modeless dialog. To do what you want, you have to make the call come from the UI thread, which you can do by calling Invoke[^] on the main form or any of the main form's controls. This will cause the delegate to be called from the UI thread and your form will be modal.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
e.g you have a method called ShowMyDialog(). You cannot call this method from another thread. Then you must use this code, if you want to call ShowMyDialog() from another thread :
MethodInvoker mInvoker = new MethodInvoker(ShowMyDialog);
Invoke(mInvoker);
|
|
|
|
|
Can ypu pls explain it with a simple example
Krishna
|
|
|
|
|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
namespace WindowsApplication5
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{ InitializeComponent(); }
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{ components.Dispose(); }
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.Location = new System.Drawing.Point(48, 72);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "Change text";
this.button1.Click += new System.EventHandler(this.button1_Click);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(208, 189);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
[STAThread]
static void Main()
{ Application.Run(new Form1()); }
private void button1_Click(object sender, System.EventArgs e)
{
Thread t = new Thread(new ThreadStart(CreateNewLabel));
t.Start();
}
private void CreateNewLabel()
{
MethodInvoker minvoker = new MethodInvoker(Run);
Invoke(minvoker);
}
private void Run()
{
try
{
Label label = new Label();
label.Name = "MyLabel";
label.Text = "MyLabel";
label.Location = new Point(50, 50);
this.Controls.Add(label);
}
catch(Exception ex)
{ MessageBox.Show(ex.ToString()); }
}
}
}
You cannot call method "Run" directly, because method "Run" is in another thread. That's why you must call the method CreateNewLabel to create a new label from another thread. You can find the complete description in : http://www.oreilly.de/catalog/csharpnutger/chapter/ch04.html
That site is in german, you can use www.google.com/translate to translate it in english.
|
|
|
|
|
I have user table.. (Uid, Uname, Upwd) , I need to authorize users like for each form. Im loging in like..
txtUserName + txtPwd->check for User exists in DB : login,Session["login"]=true, Session["UID"] else error,Session["login"]=false
simple...
But I dont want to checkup the Session varible in each form and see if the user can be allowed to view the page.
So I check up form authentication... I got this example...
<authentication mode="Forms">
<forms loginUrl="Login.aspx" protection="All" timeout="30" path="/">
<credentials passwordFormat="Clear">
<user name="test1" password="test1" />
<user name="test2" password="test2" />
</credentials>
</forms>
</authentication>
here the user name and password are in the Web.config file..
There can be many users, so I cant put all of them here...
Is there a way?
_____________________________________________________
Yea! I could be wrong...
-- modified at 0:54 Thursday 18th May, 2006
|
|
|
|
|
U can pass userid and password as the querystring in a form having method attribute as post.
aashutosh tiwari
|
|
|
|
|
Pass it to each form?....
Well that would take checking it in each form just like the Session var.
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
saud_a_k wrote: Pass it to each form?....
It is also a security risk!
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Kakuji wrote: U can pass userid and password as the querystring
This is a very unwise idea.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
See these articles on MSDN for Forms Authentication with SQL Server: .NET 1.1[^] or .NET 2.0[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I know how to put in Usernames and passwords into sql table using the MD5,
What I'm askin' is, Ive got 3 folders with files in them
Admin folder - only admin has access (Whose user name an PWD are in SQL table)
client folder-only client and admin can access
Supervisor - only Supervisor and Admin can access
How do I do this stuff using web.config ?????
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
I have created new skin but when i am seeing it in my site portal skin it is not displying any name through which I can add that skin to my site. I need this as soon as possible.
aashutosh(aashutosh.tiwari@sakasolutions.com)
|
|
|
|