|
hi for example in first form i type code
string cusername = gempanDataSet.Table1[i].username;
i got the acess file named gempan
and i used it in the first form after that i go to form2 and want to use my database again but it got error
|
|
|
|
|
arifliminto86 wrote: but it got error
Sounds as if you need to post the code, so we can see what you're doing wrong. If the access file has the field in form1, but not in form2, I'd doubt you were using the same database, or perhaps you're not using the same query. You can select only some fields from a table, maybe that's your problem.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
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.OleDb;
using System.Data.SqlClient;
namespace anggota
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdexit_Click(object sender, EventArgs e)
{
MessageBox.Show(" BYE ");
Application.Exit();
}
private void cmdok_Click(object sender, EventArgs e)
{
bool matched = false;
bool matched2 = false;
Form f1 = new Form1();
for (int i = 0; i < gempanDataSet.Table1.Count; i++)
{
string cusername = gempanDataSet.Table1[i].username;
string cpassword = gempanDataSet.Table1[i].password;
matched = matched || (txtusername.Text == cusername);
matched2 = matched2 || (txtpassword.Text == cpassword);
if (matched && matched2) break;
}
if (matched)
{
MessageBox.Show("Username Correct");
}
else
{
MessageBox.Show("UNDETECTED username");
txtusername.Text = "";
}
if (matched2)
MessageBox.Show("Password Correct");
else
{
MessageBox.Show("Wrong Password");
txtpassword.Text = "";
}
executef2();
}
private void executef2()
{
Form2 f2 = null;
if (f2 == null)
{
f2 = new Form2();
f2.Show();
}
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'gempanDataSet.Table1' table. You can move, or remove it, as needed.
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
.................................. this it form 1 and below is form2 called profile
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace anggota
{
public partial class Profile : Form
{
public Profile()
{
InitializeComponent();
}
private void txtfn_TextChanged(object sender, EventArgs e)
{
string cpassword = gempanDataSet.Table1[i].password;
}
private void Profile_Load(object sender, EventArgs e)
{
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
}
}
can u help me solve thanks
|
|
|
|
|
wow
arifliminto86 wrote: Form f1 = new Form1();
Why ?
arifliminto86 wrote: Form2 f2 = null;
if (f2 == null)
{
f2 = new Form2();
f2.Show();
}
Why ?
arifliminto86 wrote: this.gempanDataSet.Table1
Where is this data set filled ? It has the same name in Form1, but I don't see it being set in either. i.e. I don't see where this object is defined, so you'd expect it to be shared between forms of a different type.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi thanks for helping me.. actuall in form1 i already fill data with this code
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
and i want to aplly again in my profile form but it doesnt work out.. do u know what code that i have to put ..?
thanks
form1:
-------------
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.OleDb;
using System.Data.SqlClient;
namespace anggota
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdexit_Click(object sender, EventArgs e)
{
MessageBox.Show(" BYE ");
Application.Exit();
}
private void cmdok_Click(object sender, EventArgs e)
{
bool matched = false;
bool matched2 = false;
Form f1 = new Form1();
for (int i = 0; i < gempanDataSet.Table1.Count; i++)
{
string cusername = gempanDataSet.Table1[i].username;
string cpassword = gempanDataSet.Table1[i].password;
matched = matched || (txtusername.Text == cusername);
matched2 = matched2 || (txtpassword.Text == cpassword);
if (matched && matched2) break;
}
if (matched)
{
MessageBox.Show("Username Correct");
}
else
{
MessageBox.Show("UNDETECTED username");
txtusername.Text = "";
}
if (matched2)
MessageBox.Show("Password Correct");
else
{
MessageBox.Show("Wrong Password");
txtpassword.Text = "";
}
executef2();
}
private void executef2()
{
Form2 f2 = null;
if (f2 == null)
{
f2 = new Form2();
f2.Show();
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
}
}
----------------------------------
form2:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace anggota
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void cmdaccount_Click(object sender, EventArgs e)
{
}
private void lblprofile_Click(object sender, EventArgs e)
{
executeprofile();
}
private void executeprofile()
{
Profile f2 = null;
if (f2 == null)
{
f2 = new Profile();
f2.Show();
}
}
}
}
-------------------------------------------------
profile :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace anggota
{
public partial class Profile : Form
{
public Profile()
{
InitializeComponent();
}
private void txtfn_TextChanged(object sender, EventArgs e)
{
string cpassword = gempanDataSet.Table1[i].password;
}
private void Profile_Load(object sender, EventArgs e)
{
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
}
}
|
|
|
|
|
arifliminto86 wrote: this.gempanDataSet[i]
No, I have no idea why it is that you can call this.gempanDataSet on two forms and expect them both to be the same object. I don't even see where i is being set ( maybe that's the problem ? ). Either way, some sort of global nastiness seems to be going on ( although that doesn't explain why you can use 'this' for gempanDataSet).
arifliminto86 wrote: Profile f2 = null;
if (f2 == null)
{
f2 = new Profile();
f2.Show();
}
Why do you keep doing this ? Did someone tell you it was a good idea ? It's pointless.
Profile f2 = new Profile();
f2.Show();
In any case, if you want to show a modeless dialog, f2 needs to be a member variable, not a local one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi thanks for help me so far.. i already change i with 1 < just for example> but it still doesnt work.. and i already change my code with ur sugestion code.. thanks but i still dont understand why it still not working..
is it for c# we cannot call dataset in 2 form because i want to make like email program after i log in i can change my profile or my password thats why i need to use same database any suggestion plz help me.. sorry iam still beginer thats why sometime the way you talk i dont clearly understand
thanks
|
|
|
|
|
arifliminto86 wrote: is it for c# we cannot call dataset in 2 form
No, I pass datasets around all the time. The problem is that your code is broken. I still don't understand what you're doing and how. Do you?
arifliminto86 wrote: because i want to make like email program after i log in i can change my profile or my password thats why i need to use same database
Your data access should only occur in one place, as I've said, you should have a data layer in your code.
arifliminto86 wrote: sorry iam still beginer thats why sometime the way you talk i dont clearly understand
Sounds likely you're biting off more than you can chew. Too many people say things like 'I'm a beginner and I'm trying to write an email program'. If you can't understand the advice, you probably need to write something simpler first then come back to this project.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i am working in c# (.net2003)but i have a problem
i want to include system.collections.generic
but it is not working
how i will b able to include it
|
|
|
|
|
Hello
waheed awan wrote: it is not working
Why is it not working? What error do you get?
waheed awan wrote: how i will b able to include it
At the beginning of your file write
using System.Collections.Generics;
Regards
|
|
|
|
|
it doesnot allow it
when i write
using system.collections.
it gives only speciliazed option not generic
|
|
|
|
|
Nader Elshehabi wrote: At the beginning of your file write
using System.Collections.Generics;
He's using VS2003 though. That's .NET 1.1, which didn't include generics.
|
|
|
|
|
That is because generics are only available iwth .net 2.0 (2005). 1.1(2003) doesn't have them.
|
|
|
|
|
dan neely wrote: 1.1(2003) doesn't have them.
Yeah but nobody knows that because the hide information like that in the Documentation[^]
led mike
|
|
|
|
|
Really? Looking at the top of the documentation link you included I see:
Microsoft Windows SDK > .NET Framework 3.0 Development
I would not call that hidden and it definitely does not point back to version 1.1.
|
|
|
|
|
Yes, it's hidden. It's very common to hide information in places like that. Throughout history intellectuals have always hidden information in cleverly disguised places, like books, essays, articles, reference manuals and documentation. Places where no sane mane would ever look for it.
It's said that the best place to hide something is in plain view, and I believe that this goes for documentation on the web also. If the microsoft documentation had an url like http://www.killbill.org/misc, I think that a lot more people would know about it.
---
b { font-weight: normal; }
|
|
|
|
|
theRealCondor wrote: Really?
I hope you realize my post is aimed at people who don't read the documentation (there are tons of them on CP). My use of the word "hide" is sarcasm.
led mike
|
|
|
|
|
something tells me his post was meant in a similarly sarcastic manner!
|
|
|
|
|
Hi!
I have a problem!
I want to work with one of the check objects in multiselect mode.
I tried using the CheckedListBox but the .NET writes that it does not support MultiSelection, any ideas about the componenet that is already exists?
An object that gets automaticaly a scroll bar if it is too large for the form size, not stand alone radio buttons.
Thanks
|
|
|
|
|
What do you mean when you say that it doesn't support MultiSelection? If you mean checking more than one box, of course it does support that.
---
b { font-weight: normal; }
|
|
|
|
|
I am writing a client/server application that uses the SslStream class to provide a secure communications channel.
I have got the communications working, and the server certificate validation works fine (this is using self signed certs. generated by MakeCert.exe thanks to John Howard's blog http://blogs.technet.com/jhoward/archive/2005/02/02/365323.asp).
I would like to perform client certificate validation. I have generated certificates on the client in the same way as I did on the server and set the clientCertificateRequired parameter = true in the AuthenticateAsServer method as follows.
sslStream.AuthenticateAsServer(serverCertificate, clientCertificateRequired, SslProtocols.Tls, false);
When the server hits this line I get an exception:
"The remote certificate is invalid according to the validation procedure."
I have searched and searched and all I can find is stuff to do with IIS and web services.
Does anyone know what I have to do to get this working.
Thanks in advance.
Keith
|
|
|
|
|
Hi there;
Please help!!!! I am processing SQL select statement using a datarow and I would like to compare column values of current datarow with the previous datarow. Is there a way to do this?
Please Help
sasa
|
|
|
|
|
Remember that there is a DataRowCollection Class that wou can instantiate and compare in a cyclic manner with the previous instance.
The Love is the money that buys the freedom. SER
|
|
|
|
|
Thank you Grivix, I will try and look into that.
sasa
|
|
|
|
|
Does anyone know how to or know of a tutorial to programatically zip a file?
I have a series of images that need to be able to be placed in a zip file so the user can download it to their hard drive. Manually zipping these files won't work in this situation.
Thanks.
-Goalie35
|
|
|
|