|
No it's not. You've now introduced obscurity for maintenance coding. Where's i declared in your loop? Outside - that's where. Your example is now even more confusing, and I'd rip your code apart in a code review if you did that while working for me.
You're not going to convince me that you can come up with a decent reason to ignore the fact that a while loop wouldn't be a better fit here, and it's obvious to me that you aren't willing to consider that your coding practice could possibly be less accurate, so I'm going to break off this discussion now before it becomes he said/she said.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Pete O'Hanlon wrote: You've now introduced obscurity for maintenance coding.
I think it's harder to write maintainable code than to write working code. Most of us on this forum work mostly toward the working code.
..and then move on to the next project. Maintenance of the code wasn't (isn't?) a priority in school, and I made a lot of mistakes before my code became even close to being 'readable', let alone easy to maintain.
Where does one learn such things, except by trial and error?
I are troll
|
|
|
|
|
hi every body
i want know how can i change the audio sample rate and sample size in wave file
Ex: i have audio files with sample size 16bit
and i want to change it to 8 bit
how can i do this
thanks in advance
|
|
|
|
|
I've created a new setup project with Visual Studio 2008 inside my solution and added my .EXE files to the setup.
Then I've created to each .EXE a shortcut and moved it to the user's Program Menu. There I'm able to set the Icons property to an external icon.
Problem: The file and path have always to exist. If I move my solution to another computer, I'm always getting an error of missing icon file.
The Icons itself are stored in the Resources of each project inside this solution and connected to the Application Icon property.
Is it possible to use these resource icons or include them into the setup project ?
If yes, let me know how ? If no, let me also know
|
|
|
|
|
Can we catch(or overload the event handler) the (Yes, No, Cancel) button click events of Microsoft Excel when the user clicks the Close(X) button on the top right corner of the ms excel workbook? Am basically building an excel automation add-in to ms excel using c#.
|
|
|
|
|
Excel isn't written in C#, and you can't just hook into the code like you would with something that you have written yourself. You can hook into native code, you can get the handle of the buttons of the closedialog and send a click-message, but I don't know if it is possible to hook into the WndProc of Excel.
This is not a simple assignment for the weekend!
I are troll
|
|
|
|
|
hey Eddy, thanks for replying. I've been scratching my head since...
Basically, I want to create an xml for every excel sheet the user saves and when he reopens the excel sheet, I am supposed to open the corresponding xml. Thus, I used the WorkbookBeforeClose http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook_events(VS.80).aspx[^]event and my whole aim is achieved if *the user is saving the sheet first and then closing ms excel*
However, the problem is, when he is trying to save the sheet by: Press the Close(X) button and when the pop up which says "Do you want to save changes to filename.xls? 'Yes' 'No' 'Cancel'" shoots up and IF he is choosing 'Yes' here, am not able to achieve the same. The reason being, the WorkbookBeforeClose event is invoked as soon as he presses the Close(X) button on the top right corner of ms excel.
I want to somehow be able to know whether the user has chosen 'Yes' or 'No' from the pop-up. Can I?! If yes, kindly tell me how?!
Regards.
|
|
|
|
|
I'm no expert on Excel-interop, but I'm sure that some of those hang round here. In the meantime, there are two interesting events in that same documentation;
- BeforeSave
I guess this one is also fired if the user chooses "Yes", but not if he chooses "Cancel" or "No".
- ShutDown
Signals that the application is about to shut down.
Perhaps you could do the same with a FileSystemWatcher , watching all the XLS-files in the specified directories for updates.
Anyone else any idea's?
I are troll
|
|
|
|
|
Hi.
I saw it somewhere for allocate an icon to a component.
What is the name of it ?
Has it a specific name ? ( Like attribute ! )
[System.Drawing.ToolboxBitmap(typeof(WebCamCapture), "CAMERA.ICO")]
Thank you
|
|
|
|
|
Mohammad Dayyan wrote: attribute
You got it!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
how i can use the openfiledialod and savefiledialog the return picture in c#
|
|
|
|
|
Uhmm, i don't think I understood your question. What do you mean with "return picture"?
Regards
Sebastian
|
|
|
|
|
You can configure to only select picture files, but it will still return a file path or a stream, it's up to you to load it as an image, and use it however you like.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
If you are asking about to open and save only picture files then you have to add Filter to dialogs of all image file formats like *.jpg, *.gif, *.bmp
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "PNG|*.png|JPG|*.jpg";
if (ofd.ShowDialog() == DialogResult.OK)
Image img = Image.FromFile(ofd.FileName);
this may help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
In my DeviceManager i can see 3xCOM port installed. Only one of them is physical port - 2 other are virtual. When I list them:
string[] portNames = SerialPort.GetPortNames();<br />
<br />
foreach (string port in portNames)<br />
{<br />
listBox1.Items.Add(port);<br />
}<br />
I get: COM1, COM2, COM3. It tells me nothing - only that 3 ports are installed in my computer. Other way is to use WMI. It works perfectly for physical ports.
<br />
SelectQuery query = new SelectQuery("select * from Win32_SerialPort");<br />
<br />
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);<br />
<br />
ManagementObjectCollection collection = searcher.Get();<br />
<br />
foreach (ManagementObject port in collection)<br />
{<br />
listBox2.Items.Add(port["Name"].ToString());<br />
}<br />
That way i get only "Name" (Communication Port) of the physical COM port but no virtual ports are listed.
My question is: How to get property "Name" or any other of the virtual serial ports.
Thanks in advance
ps. Sorry for my bad english :]
|
|
|
|
|
What name are you expecting to see ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
try this
listBox2.Items.Add(port["Caption"].ToString());
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi ,
Anybody please help me in this ..it is an urgent for me.
i am trying to fetch excel workbook dynamically but i am not get any idea about how to create an excel sheet object who help me for uploading the excel file dynamically using fileupload dialog box.
Here is my coad
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Core ;
using System.Data.OleDb;
using Excel;
using System.Reflection;
using Microsoft.Office.Tools.Excel;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
Excel.Workbook wb;
Excel.Worksheet ws;
public Form1()
{
InitializeComponent();
// wb = new Excel.Workbook();
//ws = new Excel.Worksheet();
}
// string filename = @"C:\tmp\SpreadsheetGearOleDbBenchmark.xls";
private void button1_Click(object sender, EventArgs e)
{
string filename = @"C:\abc.xls
String connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
//String connectionString="Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source="+filename +";"+"Extended Properties=Excel 8.0;";
OleDbCommand selectCommand = new OleDbCommand ("SELECT * FROM [sheet1$]", connection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
dataAdapter.SelectCommand = selectCommand;
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
// double sum = 0.0;
// We'll make some assumptions for brevity of the code.
System.Data.DataTable dataTable = dataSet.Tables[0];
dataGridView1.DataSource = dataSet.Tables[0];
MessageBox.Show(dataGridView1.RowCount.ToString());
connection.Close();
openFileDialog1.ShowDialog();
//openFileDialog1.ShowDialog();
// return sum;
// directorySearcher1.FindAll();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
openFileDialog1.ShowDialog();
Excel.Application excel = new Excel.Application();
}
}
}
|
|
|
|
|
I'm sorry, what it is exactly you're trying to do?
I understand you have an excel spreadsheet on your local drive and want to upload it somewhere...
Where?
What do you mean by "fetch an excel spreadsheet dynamically"?
Rephrase your post or do not, there is no "try" ;>
var question = (_2b || !(_2b));
|
|
|
|
|
here i read only one specific file in that program
i want to fetch excel file using file up load but i am unable to fetch acctual path of the file
I want to upload file on same com
|
|
|
|
|
how i can use the openfiledialod to open excel files in c# appilcation
|
|
|
|
|
openFileDialog1.ShowDialog();
System.Diagnostics.Process.Start(openFileDialog1.FileName);
No need upload anything. You have to have Excel installed, otherwise the system will not know what to do with the file.
var question = (_2b || !(_2b));
|
|
|
|
|
Hi ,
Anybody please help me in this ..it is an urgent for me.
Actually i have a DataGridview in my window which should be with one fixed row and 2 fixed columns.
Fixedrow is done in Datagridview with the headercolumn property. Now i need to add 2 columns as fixed..
I tried with cell.frozen property, then the column is frozen, but still the tab control goes into this cells.and also it is not appearing same as column header.
Is there a way to make this 2 columns as rowheader?
In VB6 Flexgrid we have the option Fixedcols=2 ....is there any equivalent in DataGrideview windows C#?
Anyone please help me, asap...
Thanks in advance.
- Rami
|
|
|
|
|
Use TemplateFields and then set the AutoGenerateColumns= false. Hmmm I think I haven't understood your question clearly...anyways hope this one helps you
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|