|
yes, that has smart client Capabilities
can it be done?
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
How to hide the particular column in Listview?
i set columnName.width=0; But user can Easly Resize the column width. how to avoid this?
Thanka in Advance.
-Mohan
|
|
|
|
|
if you dont want the column to be used why have it on the list view?
I cant see any obvious way through the properties so all i can suggest is you create the columns at run time before populating the list view.
Sorry to not be much use.
|
|
|
|
|
Hmmm... Not actually sure... Just a possible hint...
If you can use ".Width", can't you go ".Visible = false;" or ".Enabled = False;" linked with the ".Width = 0;"
?
Just my 2c worth....
|
|
|
|
|
Thats the first thing I tried, I just put a list view on a form added some columns to it and then in the forms constructor tried to do:
listView.Columns[0].Visible (no such property)
listView.Columns[0].....
Then I went back up to the list view control and tried to see if there was anything you could set on there but no luck.
In my work I use infragisitics controls which allows this behaviour and I use it a lot so this query intrigued me as its suprising you cant do it on a win forms control.
anyway good luck.
|
|
|
|
|
The WinForms listview is pretty worthless for dynamic data. It doesn't support databinding or hiding columns.
I wrote my own hodge-podge listview a while back to support binding at design time as well as customized embeded controls, in-line field editing column filtering and grouping but it's pretty feeble... not to mention buggy.
One of these days I'll whip out Reflector and see just what's under the hood for the DataGridView and modify my control to be more similar.
What would really make sense would be a ListView with all the functionality of a DataGridView. Which is why, I suppose, there are so many custom listviews that have said features on the market.
How do you like Infragistics anyway? Maybe I can get my boss to spend some money on a useful control.
|
|
|
|
|
hey
sorry for the delay
Infragisitics is OK, I would like to say good but the thing that brings that down to an OK standard is the hill you have to climb to learn and understand the controls, it can feel like walking up everest some times!
Of course every control set has an inital learning curve but this is the biggest one i have had the pleasure of going through.
(Warning: A little rant!)
Take the other day i had a list view in Details mode, by default each item in the list view gets a "i dont know the item type" icon. So of course i wanted to remove this icon, sounds easy huh....
Step 1: I checked out the "Image" property - this was set to (none) so fair enough not that one then
Step 2: The imageSize property - this was set to (-1, -1)
Step 3: I looked through every other property imaginable to do with appearances and image settings and no luck.
so after a few hits of coffee and a few trawls through the forums etc I had a brain wave - i went to the image size propery which was set to (-1,-1) and set it to (0,0) and hey presto no image! (pure luck that was, i still to this day cant see why 0,0 means no image and -1,-1 means display a default image)
All said and done though they are very configurable and very usable, they do provide a lot more functionality than win forms so i cant fault the controls themselves too much. Overall I would recommend them to be honest but they should come with some sort of health warning like "we like the game hide and seek, we hope you do too".
|
|
|
|
|
All is understood.
Thanks for letting me know.
|
|
|
|
|
Don't put the column in the ListView. Write your code to setup only the columns you need in the ListView and populate only those columns.
|
|
|
|
|
Hi Guys. I have the below code to create a user. I want to check if the user exist first and if he does not exist then create else show message box that the user already exist. Can somebody please help me with this? Below the code I have. This data is stored in an Access DB.
try
{
if (txtboxPassword.TextLength <= 6)
{
MessageBox.Show(this, "Please re-enter a password longer than 6 charcaters", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
conn.Open();
m_daDataAdapter =
new OleDbDataAdapter("Select * From [Users]", conn);
OleDbCommandBuilder m_cbCommandbuilder =
new OleDbCommandBuilder(m_daDataAdapter);
m_daDataAdapter.Fill(m_dtPassword);
DataRow dr = m_dtPassword.NewRow();
dr["UserName"] = txtboxUserName.Text;
dr["Pwdchk"] = cipherText;
m_dtPassword.Rows.Add(dr);
m_daDataAdapter.Update(m_dtPassword);
txtboxUserName.Text = "";
txtboxPassword.Text = "";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
}
|
|
|
|
|
Kwagga,
Firstly, id recommenced you read this:
http://www.codeproject.com/KB/database/SqlInjectionAttacks.aspx[^]
If you want to check whether or not a user is there, just do a:
select userId from [Users] where userName = theUsername;
And then check on the dataset you have filled has rows. eg:
dataSet.Table[0].Rows.Count > 0
And then just do whatever else you want.
Regards,
Gareth.
|
|
|
|
|
Does someone know how can i get the owner of my application(Desktop maybe is the owner but how can i retrieve this owner)
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
The owner of what aspect? The desktop does house the application, but the forms of the application are not parent to any other process execpt your application. (Technically speaking may be different, either way).
Why do you want the owner?
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
hello,
when i open an extended desktop the open file dialog of my application open in the other screen.
how can i do to open the dialog and the appplication in the same desktop
10x regards
dghdfghdfghdfghdgh
|
|
|
|
|
Hi,
Does anyone have code to loop through data displayed in a datagrid and display that data in a new Excel spreadsheet?
Thanks in advance.
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
Microsoft.Office.Interop.Excel._Application _appClass = new ApplicationClass();<br />
_appClass.Visible = true;<br />
_appClass.Caption = "Excel custom title";<br />
Microsoft.Office.Interop.Excel.Workbook wbk = _appClass.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);<br />
Worksheet obj = (Worksheet)wbk.ActiveSheet;<br />
Range r = (Range)obj.Cells;<br />
for (int i = 0; i < ((GridView)this.lsvDocumentList.View).Columns.Count; i++)<br />
{<br />
r[1, i + 1] = ((GridView)this.lsvDocumentList.View).Columns[i].Header.ToString();<br />
((Range)r.Cells[1, i + 1]).Font.Bold = true;<br />
}
The above code is using a XAML listview, so it may be slightly different with WinForms. You need to also make sure to reference the Excel dll.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi,
Thanks for the answer, but I tried to convert it and it works but strangely it only shows the headings of the datagrid. Can you tell me what causes this. Here is my code:
Microsoft.Office.Interop.Excel._Application _appClass = new ApplicationClass();
_appClass.Visible = true;
_appClass.Caption = "Excel custom title";
Microsoft.Office.Interop.Excel.Workbook wbk = _appClass.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
Worksheet obj = (Worksheet)wbk.ActiveSheet;
//Range r = (Range)obj.Cells[this.lsvDocumentList.Items.Count + 1, ((GridView)this.lsvDocumentList.View).Columns.Count + 1];
Range r = (Range)obj.Cells;
for (int i = 0; i < ((DataGridView)this.dgOutput).Columns.Count; i++)
{
r[1, i + 1] = ((DataGridView)this.dgOutput).Columns[i].HeaderText.ToString();
((Range)r.Cells[1, i + 1]).Font.Bold = true;
}
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
It only shows headers because that is the only code that I gave you. You need to add another loop after the for loop to work with the cells.
The following code is what prints the headers to the excel document. Just try to duplicate the same results through trial-and-error. I would give you the cell output code, but my code does a whole bunch of extra stuff that would be to confusing to explain If you continue to have problems with trying to create your own code 'based' on what I gave you, then post back and I'll look more into it.
<br />
for (int i = 0; i < ((DataGridView)this.dgOutput).Columns.Count; i++)<br />
{<br />
r[1, i + 1] = ((DataGridView)this.dgOutput).Columns[i].HeaderText.ToString();<br />
((Range)r.Cells[1, i + 1]).Font.Bold = true;<br />
} <br />
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi,
Thanks again for the reply.
Did you mean something like this:
for (int i = 0; i < ((DataGridView)this.dgOutput).Columns.Count; i++)
{
r[1, i + 1] = ((DataGridView)this.dgOutput).Columns[i].HeaderText.ToString();
((Range)r.Cells[1, i + 1]).Font.Bold = true;
for (int j = 0; j < ((DataGridView)this.dgOutput).Columns.Count; i++)
{
r[1, j + 1] = ((DataGridView)this.dgOutput).Columns[j].ToString();
}
}
The inner for loop does not print the cells and throws the ff exception:
HRESULT: 0x800AC472
Regards,
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
it looks like you have the second for loop inside the first, that is not what you want to do.
Here is some pseudocode to assist you
foreach column in the data grid that contains header information
{
r[1,colIndex]=column text
}
foreach row in the data grid that contains information to write to database
{
r[row+1,1]=first column of the specified row will write its data to the excel spreadsheet
r[row+1,2]=second column of the specified row will write its data to the excel spreadsheet
}//this will increment for every row in the data grid.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thanks a lot, this was very helpful.
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
I have this code that will export to a CSV file. Maybe it will help.
StreamWriter sw = new StreamWriter(@"C:\EPORT\ExportFile_" + DateTime.Today.ToString("ddMMyyyy") + ".csv", false);
DataTable dt = m_dtMobEmail;
int iColCount = dt.Columns.Count;
for (int i = 0; i < iColCount; i++)
{
sw.Write(@"""{0}""", dt.Columns[i]);
if (i < iColCount - 1)
{
sw.Write(",");
}
}
sw.Write(sw.NewLine);
foreach (DataRow dr in dt.Rows)
{
if (dr["Exported"].ToString() == "0")
{
for (int i = 0; i < iColCount; i++)
{
if (!Convert.IsDBNull(dr[i]))
{
sw.Write(@"""{0}""", dr[i].ToString());
}
if (i < iColCount - 1)
{
sw.Write(",");
}
}
sw.Write(sw.NewLine);
}
}
sw.Close();
|
|
|
|
|
I was sure I posted this message earlier... Although it didn't show under my posts... *Shrug*
Also, there's no "Graphics" section, and it is really C# Code...
Anyways, I was chatting to a few people who refuse to use GDI+ due to it's lack of "Flashy Effects" - Tinting, Lighting, Etc.
So, I ask you now - Is it possible?
Maybe a cool fiery effect (Fantastic Flame Screensaver, Anyone?)
Post your suggestions / Code Snippets showing off your "Special Effects"
Be Creative people
- Reelix
|
|
|
|
|
If you are interested in finding out how to do flashy effects, you should think about checking out Paint.Net - its an open source alternative to PhotoShop, which as far as I am aware, is programmed with GDI+ and can produce some quite nice stuff!
Chris
|
|
|
|
|
Hi,
Any one have to help me in this regard.. please........... since new to c#.net.
thanks in advance
I have a "logging.exe.config" file in different location,
I have to
1. Load The File,
2. Read The file
3. Modify particular values.
4. Update and Save The file in the same location.
My "Logger.exe.config" looks something like this
i need to set the values like enabled,logging values to true/false,.............
Please anyone help me...............
<?xml version="1.0" encoding="utf-8"?><br />
<configuration><br />
<configSections><br />
<section name="WriterTrace2Config" type="Configuration.ConfigSectionReader, Infrastructure.Logging.Helper" /><br />
<section name="TextReaderLogConfig" type="Configuration.ConfigSectionReader, Infrastructure.Logging.Helper" /><br />
</configSections><br />
--------------<br />
---------------<br />
<Listeners><br />
<ListenerInfo Type="Infrastructure.Logging.WriterTraceListener2,Infrastructure.Logging.Listeners.WriterListener2" Enabled="true" Name="TextLogger2" /><br />
<ListenerInfo Type="Infrastructure.Logging.TextReaderLog,Infrastructure.Logging.Listeners.TextReaderLogListener" Enabled="true" Name="TextReaderLog" /><br />
</Listeners><br />
--------------<br />
---------------<br />
<WriterTraceListener2Config type="Infrastructure.Logging.WriterTraceListener2Config,Infrastructure.Logging.Library.ConfigurationManager" xmlns="http://Infrastructure/Configuration.xsd" Name="WriterLog" Filtering="false"><br />
<Storage Location="C:\Logs\WriterLog" LogFileNamePrefix="TraceLog" Logging="false" SubDirectoryNamePrefix="Writer"><br />
<HeaderText>Logging Service Helper</HeaderText><br />
</Storage><br />
</WriterTraceListener2Config><br />
<TextReaderLogListenerConfig type="Infrastructure.Logging.ListenerConfig.TextReaderLogListenerConfig, Infrastructure.Logging.Listeners.TextReaderLogListener" xmlns="http://Infrastructure/Configuration.xsd" Name="ReaderLog" Filtering="true"><br />
<Storage Location="c:\Logs\TextReaderLog" SubDirectoryNamePrefix="TextReaderLog"><br />
<HeaderText>Logging Service Helper</HeaderText><br />
</Storage><br />
</KTTextRunLogListenerConfig><br />
</configuration>
BhuMan
|
|
|
|