I need help plzzzz... In my windows application i fill listview from simple
access database...
here is the code
//Creating colums
InitializeComponent();
listView_result.Columns.Add("ID",87,HorizontalAlig nment.Left);
listView_result.Columns.Add("Name",180,HorizontalA lignment.Left);
listView_result.Columns.Add("Cash",81,HorizontalAl ignment.Left);
//Fill the listview
try
{
oleDBConn.open();
SelectCommand.CommandText = "SELECT Serial_no, Name, Cash from Cheque";
OleDbDataReader reader;
reader = SelectCommand.ExecuteReader();
listView_result.Clear();
while(reader.Read())
{
ListViewItem lvi= new ListViewItem(reader["Serial_no"].ToString());
lvi.SubItems.Add(reader["Name"].ToString());
lvi.SubItems.Add(reader["Cash"].ToString());
listView_result.Items.Add(lvi);
}
reader.Close();
oleDBConn.close();
} catch (Exception e) { MessageBox.Show(e.ToString()); }
When i click the fill button the column disappear and the control look like
it's freeze!!!
there is no problem in the connection string or the query, the while loop is
working but when it come to dispaly result the problem rise.
What's wrong... i need urgent help 8 3970
I prefer to build my list view items this way... perhaps you will have
more success with this:
string[] columnItems = new string[] { new
ListViewItem(reader["Serial_no"].ToString(), reader["Name"].ToString(),
reader["Cash"].ToString() };
ListViewItem lvi = new ListViewItem(columnItems);
thanks alot.. when i create Columns collection visually and build my list
using ur array way it's work now great...
1-May i know what's wrong in my way??
2-How can i hide the ID field and use it to retrive the full data when user
bouble click a record??
thanx alot
"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... I prefer to build my list view items this way... perhaps you will have more success with this:
string[] columnItems = new string[] { new ListViewItem(reader["Serial_no"].ToString(), reader["Name"].ToString(), reader["Cash"].ToString() }; ListViewItem lvi = new ListViewItem(columnItems);
I got the reason for the error.
In my code below i add columns b4 i fill the subitem..for some reason this
coz error, after i moved the "Creating columns" code below the while loop
it's now work perfect!!
I can't understand why this order make an error but at least i solved my
problem ^_*
"Islam Elkhayat" <is******@yahoo.com> wrote in message
news:Oa**************@TK2MSFTNGP14.phx.gbl... I need help plzzzz... In my windows application i fill listview from simple access database... here is the code
//Creating colums InitializeComponent(); listView_result.Columns.Add("ID",87,HorizontalAlig nment.Left); listView_result.Columns.Add("Name",180,HorizontalA lignment.Left); listView_result.Columns.Add("Cash",81,HorizontalAl ignment.Left);
//Fill the listview try { oleDBConn.open(); SelectCommand.CommandText = "SELECT Serial_no, Name, Cash from Cheque"; OleDbDataReader reader; reader = SelectCommand.ExecuteReader(); listView_result.Clear(); while(reader.Read()) { ListViewItem lvi= new ListViewItem(reader["Serial_no"].ToString()); lvi.SubItems.Add(reader["Name"].ToString()); lvi.SubItems.Add(reader["Cash"].ToString()); listView_result.Items.Add(lvi); } reader.Close(); oleDBConn.close(); } catch (Exception e) { MessageBox.Show(e.ToString()); }
When i click the fill button the column disappear and the control look like it's freeze!!! there is no problem in the connection string or the query, the while loop is working but when it come to dispaly result the problem rise. What's wrong... i need urgent help
You can point the ListViewItem directly at your data:
string[] columnItems = new string[] { reader["Serial_no"].ToString(),
reader["Name"].ToString(), reader["Cash"].ToString() };
ListViewItem lvi = new ListViewItem(columnItems);
lvi.Tag = myObject;
....then, when you want it back, just cast lvi.Tag to the correct type.
Hi,
Just read your post, I hope you still got it.
I think the problem is that you add the columns and then call
listView_resul.Clear().
you should use listView_result.Items.Clear() instead, since the first one
clears the column headers as well.
Picho
----- Original Message -----
From: "Islam Elkhayat" <is******@yahoo.com>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Thursday, January 27, 2005 3:07 AM
Subject: ListView Control drive me crazy!! I need help plzzzz... In my windows application i fill listview from simple access database... here is the code
//Creating colums InitializeComponent(); listView_result.Columns.Add("ID",87,HorizontalAlig nment.Left); listView_result.Columns.Add("Name",180,HorizontalA lignment.Left); listView_result.Columns.Add("Cash",81,HorizontalAl ignment.Left);
//Fill the listview try { oleDBConn.open(); SelectCommand.CommandText = "SELECT Serial_no, Name, Cash from Cheque"; OleDbDataReader reader; reader = SelectCommand.ExecuteReader(); listView_result.Clear(); while(reader.Read()) { ListViewItem lvi= new ListViewItem(reader["Serial_no"].ToString()); lvi.SubItems.Add(reader["Name"].ToString()); lvi.SubItems.Add(reader["Cash"].ToString()); listView_result.Items.Add(lvi); } reader.Close(); oleDBConn.close(); } catch (Exception e) { MessageBox.Show(e.ToString()); }
When i click the fill button the column disappear and the control look like it's freeze!!! there is no problem in the connection string or the query, the while loop is working but when it come to dispaly result the problem rise. What's wrong... i need urgent help
thanx u r right...
How could i load deffrent language using 2 button for the languages.. i use
thread.currentthread.cultureinfo
but it don't work!!
"Picho" <SP********@telhai.ac.il> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl... Hi,
Just read your post, I hope you still got it.
I think the problem is that you add the columns and then call listView_resul.Clear(). you should use listView_result.Items.Clear() instead, since the first one clears the column headers as well.
Picho
----- Original Message ----- From: "Islam Elkhayat" <is******@yahoo.com> Newsgroups: microsoft.public.dotnet.languages.csharp Sent: Thursday, January 27, 2005 3:07 AM Subject: ListView Control drive me crazy!!
I need help plzzzz... In my windows application i fill listview from simple access database... here is the code
//Creating colums InitializeComponent(); listView_result.Columns.Add("ID",87,HorizontalAlig nment.Left); listView_result.Columns.Add("Name",180,HorizontalA lignment.Left); listView_result.Columns.Add("Cash",81,HorizontalAl ignment.Left);
//Fill the listview try { oleDBConn.open(); SelectCommand.CommandText = "SELECT Serial_no, Name, Cash from Cheque"; OleDbDataReader reader; reader = SelectCommand.ExecuteReader(); listView_result.Clear(); while(reader.Read()) { ListViewItem lvi= new ListViewItem(reader["Serial_no"].ToString()); lvi.SubItems.Add(reader["Name"].ToString()); lvi.SubItems.Add(reader["Cash"].ToString()); listView_result.Items.Add(lvi); } reader.Close(); oleDBConn.close(); } catch (Exception e) { MessageBox.Show(e.ToString()); }
When i click the fill button the column disappear and the control look like it's freeze!!! there is no problem in the connection string or the query, the while loop is working but when it come to dispaly result the problem rise. What's wrong... i need urgent help
not sure i understood, but if you want to select a language programaticly
(like pressing alt+shift):
enumerate all installed languages using the InputLanguage class in the
System.windows.Forms namespace.
foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
{
string name = lang.Culture.DisplayName;
// set the input language:
InputLanguage.CurrentInputLanguage = lang;
}
HTH
Picho
"Islam Elkhayat" <is******@yahoo.com> wrote in message
news:u1**************@TK2MSFTNGP12.phx.gbl... thanx u r right... How could i load deffrent language using 2 button for the languages.. i use thread.currentthread.cultureinfo but it don't work!!
"Picho" <SP********@telhai.ac.il> wrote in message news:%2***************@TK2MSFTNGP12.phx.gbl... Hi,
Just read your post, I hope you still got it.
I think the problem is that you add the columns and then call listView_resul.Clear(). you should use listView_result.Items.Clear() instead, since the first one clears the column headers as well.
Picho
----- Original Message ----- From: "Islam Elkhayat" <is******@yahoo.com> Newsgroups: microsoft.public.dotnet.languages.csharp Sent: Thursday, January 27, 2005 3:07 AM Subject: ListView Control drive me crazy!!
I need help plzzzz... In my windows application i fill listview from simple access database... here is the code
//Creating colums InitializeComponent(); listView_result.Columns.Add("ID",87,HorizontalAlig nment.Left); listView_result.Columns.Add("Name",180,HorizontalA lignment.Left); listView_result.Columns.Add("Cash",81,HorizontalAl ignment.Left);
//Fill the listview try { oleDBConn.open(); SelectCommand.CommandText = "SELECT Serial_no, Name, Cash from Cheque"; OleDbDataReader reader; reader = SelectCommand.ExecuteReader(); listView_result.Clear(); while(reader.Read()) { ListViewItem lvi= new ListViewItem(reader["Serial_no"].ToString()); lvi.SubItems.Add(reader["Name"].ToString()); lvi.SubItems.Add(reader["Cash"].ToString()); listView_result.Items.Add(lvi); } reader.Close(); oleDBConn.close(); } catch (Exception e) { MessageBox.Show(e.ToString()); }
When i click the fill button the column disappear and the control look like it's freeze!!! there is no problem in the connection string or the query, the while loop is working but when it come to dispaly result the problem rise. What's wrong... i need urgent help
I think that the OP would like to know how to put two buttons on the
screen, or two menu choices. If the user clicks one button (or chooses
one menu item), the languages changes to Japanese (for example); if the
user clicks the other button (or chooses another menu item), the
language changes to English.
Something like that. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: pointBoarder |
last post by:
I'm following the article from
http://support.microsoft.com/default.aspx?scid=kb;en-us;155178
The above article explains how to fill a listview. For some reason I
keep recieving "User-defined...
|
by: Welie |
last post by:
Hi all-
I am using a listview (MSComctlLib.ListViewCtrl.2)on an Access form.
Actually there are six listviews on the form. I need to do the same
thing to all six forms so I have the loop below....
|
by: Riccardo Giomi |
last post by:
Hi
I would to display a Cursors.WaitCursor on a ListView control, so I tried
listView.Cursor = Cursors.WaitCursor
but it doesn't work at all, I see always the default cursor. The same thing...
|
by: willow1480 |
last post by:
I am developing a small little Service Control Application. I am
using a listview control with checkboxes and getting the list of
services I want to control from a text file. When you check a...
|
by: Dennis |
last post by:
I have a form which has a ListView control named ListView1 added at design
time. When I add items using the following code, they don't appear in the
list view. However, if I create a ListView...
|
by: Jack |
last post by:
Hello,
I've noticed through searching this group's previous posts that one can get
the item the mouse is over in a listview control but I did not see how to get
the subitem the mouse is over. Is...
|
by: =?Utf-8?B?SXJmYW4=?= |
last post by:
Hello,
It may be a repeated question but I don't find the solution to the situation
that I encounter in it.
My application is monitoring another application that is built in VB6. The...
|
by: FireFlux |
last post by:
Inherit the Listview Control with Visual Basic ?
I have decided do inherit the Listview control some days ago to change some painting things to make the .net Listview look like the explorer's...
|
by: Brian Gaze |
last post by:
I have created a ListView control and have bound this to a datasource.
Within the ItemTemplate of the ListView I have added another ListViewControl
which is databound in the code behind. The idea...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |