|
this is for entire column i think i need to add a control to only one cell i.e first cell of grid.
|
|
|
|
|
I have 2 questions.....
1) Are you binding your grid dynamically or is it fix and records won't change?
2) Why you need control only in one cell, is there any specific purpose?
|
|
|
|
|
i made a project for my final year that has a robot which is controlled via Wiimote.
now i want to add a surveillance camera to it...
so i just thought if i can use my mobile phone (mine is motorola A1200) or any other mobile phone as a webcam which will send videos or images to the C# appl. through bluetooth...
i have found applications which access the webcam in C# but couldnt find anything related to bluetooth cameras
if someone can post some links or codes then it would be really helpful
thanks in advance...
|
|
|
|
|
Hi all
1.I would like to copy(programmactically) some tables(Mysql DB) from server into local machine(MS Access) when a user login is successful.
2.After a user has done something on local database, (eg. update, insert etc), the changes will update back the sever database.
Is there any idea pls? Could anybody help me?
Thanks in advance.
Kyi Kyi
|
|
|
|
|
Are the client and server on the same network? If so you can connect directly to the server from your app and transfer the data. Otherwise you'll need a web service to access the server data
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
thank you very much. I'll try.
|
|
|
|
|
1.Get the DataTable from the MYSQL SERVER. and then insert the data to the MS Access.
2.compare the difference of data between MYSQL SERVER and MS ACCESS and then update the changes back to MYSQL SERVER.
This web site is useful for you about the connection string.
http://connectionstrings.com/[^]
|
|
|
|
|
thanks yu-jian
|
|
|
|
|
hi i'm having hard time on how to display two column values in combox display member..like custID and custName...any sample code plz help
|
|
|
|
|
Hi,
Not sure how you would do it using the .NET toolkit (ComboBox), but if you make use of the control toolkit from DevExpress (which has 60 free controls), you can make use of their LookUpEdit control, which has this type of functionality. Here is an example if you are interested: LookUpEdit Control[^]
Kind regards,
|
|
|
|
|
Its quite simple actually :
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Name");
while(reader.Read())
{
DataRow dr = dt.NewRow();
dr["ID"] = reader.GetValue(0);
dr["Name"] = reader.GetValue(0) + reader.GetValue(1);
dt.Rows.Add(dr);
}
combobox.DataSource = dt;
combobox.DataBind();
Hope this helps you.
|
|
|
|
|
Hi,
I develop a c#smart device application.
I create a Form MenuPrincipalusing listview tool.My listview contains 3 items:stock,Information,Quit.I wanna program these 3 items:stock to go to the Form Stock,information to go to the Form Information,and quit to close the application(the emulator in my case because i work with c# smart device)
How can i program this?This code doesn't work for me:
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{ListView lv = (ListView)sender;
ListViewItem item = new listviewitem();
if (item != null)
{
switch (item.Text)
{
case "Stock":
ShowStockForm();
break;
case "Information":
ShowInfoForm();
break;
case "Quit":
QuitApplication();
break;
}
}
}
private void QuitApplication()
{
Application.Exit();
}
private void ShowInfoForm()
{
InfoForm form = new InfoForm();
form.ShowDialog();
}
private void ShowStockForm()
{
StockForm form = new StockForm();
form.ShowDialog();
}
}
Thanks a lot for u contribution
|
|
|
|
|
ok, so you're not understanding a basic concept.
You created a NEW listview item and then checked to see what it contained.
Tunisien86 wrote: ListViewItem
item = new listviewitem();
if (item != null)
There is nothing in the item.Text property, so nothing will happen.
What you want is
item = lv.SelectedItems(0);
|
|
|
|
|
Hi,
I tried as this:
ListView lv = (ListView)sender;
ListViewItem item = new listviewitem();
item = lv.SelectedItems(0);
if (item != null)
{....
but this error appears:
Error 2 'System.Windows.Forms.ListView' does not contain a definition for 'SelectedItems' and no extension method 'SelectedItems' accepting a first argument of type 'System.Windows.Forms.ListView' could be found (are you missing a using directive or an assembly reference?) C:\Users\Admin\Documents\Visual Studio 2008\Projects\GMAOMobile\ModeDifféré\Form1.cs 24 11 ModeDifféré
Thanks
|
|
|
|
|
sorry...I mixed up languages a bit...I normally code in VB.NET.
It should have been:
ListView lv = (ListView) sender;
if (lv.SelectedItems.Count <> 0)
{
ListViewItem item = lv.SelectedItems[0];
switch (item.Text)
{
...
you're using it as an array, so you need brackets not parens. And, just FYI, if you are going to assign item to an already created item, you don't need to say item = new ListViewItem();
And, I changed it...you should check the SelectedItems.Count value first to see if there is anything selected, instead of doing if (item != null) .
|
|
|
|
|
try this
inside your lv_SelectedIndexChanged() method
ListView.SelectedIndexCollection indexes = lv.SelectedIndices;
foreach (int index in indexes)
in the index u will get the selected index
no need of going for Listviewitem
|
|
|
|
|
Hi,
Thank u a lot.It is well run
U freind Marwen
Tunisia
|
|
|
|
|
Hi,
I develop a Csharp smart device application.I create a FormConnexion to let me when I enter a login and password to verify these parameters in my database .sdf.The code i write is this below
private void button1_Click(object sender, EventArgs e)
{
string s1 = textBox1.Text;
string s2 = textBox2.Text;
SqlCeConnection cnx = new SqlCeConnection();
string wCS = String.Format("DATA SOURCE = '{0}';", Program.gFichierBase);
cnx.ConnectionString = wCS;
string req = "SELECT * FROM Connexion WHERE Login = @login AND MotPasse = @pass";
SqlCeCommand cmd = new SqlCeCommand(req, cnx);
SqlCeParameter login = new SqlCeParameter("login", s1);
cmd.Parameters.Add(login);
SqlCeParameter pass = new SqlCeParameter("pass", s2);
cmd.Parameters.Add(pass);
BaseGmaoLocaleDataSet2 dat = new BaseGmaoLocaleDataSet2();
DataRow[] foundRows;
foundRows = dat.Tables["Connexion"].Select("Login like '%" + s1 + "%' and MotPasse like '%" + s2 + "%'");
if (foundRows != null)
{
MessageBox.Show("Authentification réussie");
MenuP m = new MenuP();
m.Show();
}
else
{
MessageBox.Show("Login ou mot de passe incorrect veuillez réessayer");
}
}
The problem is that any login and password I enter,it lets me pass"successful authentification"
How can i modify this code?
Thanks
|
|
|
|
|
Hi again,
1.
DataTable.Select never returns null
2.
I suggest you return to your earlier thread and read the replies you got there (again). Your code has several issues.
|
|
|
|
|
Hi Luc,
The code I gave is the result of all my earlier thread suggestions.I don't know really what is the problem.
I will be very grantful if u help me to depass that problem.
Thanks
|
|
|
|
|
I explained what wasn't OK with your code 8 hours ago. I'm not going to repeat it here, you can still read it back there.
|
|
|
|
|
Hi,
Thank u for u last helps.The only notice I don't understand is this:
it should work, however I don't think wildcards are a good idea for authentication.
Chances are entering
username: a
password: a
will let you in, as it would match Jan/MySecretPassword as well as an infinite number of other possible accounts.
Smile
Thank u in all cases
|
|
|
|
|
LIKE '%a%'
matches each of the following:
a
aaaa
bac
WhateverTheUserEntersAsLongAsItContainsAtLeastOneLowerCaseA
is that what you want for authentication purposes?
|
|
|
|
|
Hi,
I understand.But how can i use that to depass my problem??
Thank u Luc for u great help.It seems sometimes annoying but really it is my first time that i develop a full application with csharp.Many problems that i should depass
Thanks
|
|
|
|
|
God...you've totally mixed ideas from your last thread without actually finishing one.
You created dat, but you never actually filled it with any values. You need to use the Select statement to fill the datatable. The way you have it, nothing will ever be in the datatable.
As Luc has said, dat.Tables["Connexion"].Select will never return a null value. it will return an array of DataRow...in your case with an upper bound of -1.
First, read up on ADO.NET. Then, use a SELECT statement to fill a datatable using the "WHERE login = @login...".
Then, you just check the datatable Rows.Count property to see if it has rows.
And, again, like they've said, don't use "like" in password authentication. "Like %a%" will return a high percentage of words (any word with 'a' in it).
ADO.NET[^] (it's in English...hopefully your English is good enough to get through it...otherwise, find a book in French on ADO.NET)
|
|
|
|