|
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)
|
|
|
|
|
Hi Spunky Coder,
Thanks for your reply
Can you explain me how to use Templatefields,
Actually i need to make my first 2 columns of my grid as fixed columns (row header)..
Thanks for your help...
-Rami.
|
|
|
|
|
he is not asking about asp
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
|
|
|
|
|
I was saying about TemplateField property in a GridView. Huhhh I accept that these IDE's make me a bit lazy in remembering the syntax...I wonder how can I code without IDE's Intellisense Hey I'm sorry...I haven't realized that this is a C# forum
"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)
modified on Tuesday, March 17, 2009 6:25 AM
|
|
|
|
|
Hi Spunky coder,
There is no TemplateField Property in DataGridView of Windows C#...
Can you help me on this....
Thanks.,
-Rami.
|
|
|
|
|
I have an form which is called from another form.
How can i close the called form when i click a button in the parent form.
Thankyou,
YPKI
|
|
|
|
|
when you show that child form, keep its intance and call Close() when require.
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
|
|
|
|
|
Here is the code..
public partial class FormParent : Form
{
public FormParent()
{
InitializeComponent();
}
FormChild frmChild;
private void btnLoadForm2_Click(object sender, EventArgs e)
{
frmChild = new FormChild();
frmChild.Show();
}
private void btnCloseFrom2_Click(object sender, EventArgs e)
{
frmChild.Close();
}
}
|
|
|
|
|
Please Reply back to state whether you got what you want. .
This helps in unnecessary replies from other users. .
So if you are done with your query .. Please reply informing something like got you. .
Or completed . .
Please . .
|
|
|
|
|
Hi,
I have created a client socket and when I try to connect to a remote IP address, I receice an exception
"An address incompatible with the requested protocol was used".
Code works fine on XP but it throws this exception when run on Vista.
I believe that Vista uses IPV6 by default for IPAddress and not IPV4.
This could be the reason.
But I am not able to find out the solution as how to handle it.
Please suggest.
- Nihar
|
|
|
|
|
niharshukla wrote: I believe that Vista uses IPV6 by default for IPAddress and not IPV4.
I do not think so...however vista is more secure than XP. I would like to suggest that off your firewall and then check.
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 All
I have two files
1.Application File
2.Import File
I have some data to be imported to Application File from import file.
When the file to be imported is in the executing directory and i run the application the code is working fine and actually importing the data to the application file.
Now the challenge is when the Import File is not in the executing directory.My application do not give any error and also runs fine(i used breakpoints and checked the intermediate values of variables(all were correct)).From intermediate variables i conclude that my application is reading data from the file to be imported correctly.But it is not writing into it.And after closing the application The application file is supposed to have Imported data from the import file.But it donot have any imported data and shows the data of previous state.
After that I decided to go for an alternative
I decided to copy the import file from another location(say desktop)
to executing directory.
First I used
1.Fileinfo f = new FileInfo("Fully qualified path of import file");
f.CopyTo(@"tempdata.olf");
2. i used FileStream code to copy files using Binary reader and binary writer
The code works fine and do not throw any runtime errors or exception
But the import file is not copied to the tempdata.olf.
Note:
1.I have used FullName(fully Qualified Path) of both files
2.The application is working as desired only when both the files are in executing directory.
3.I am running the application in admin account
Does anyone has idea what may be wrong.
Thanks
Regards
THE SK
|
|
|
|
|
Are you using Vista ? Vista creates 'magic folders', if you don't have good security settings, I believe.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|