|
Try this
mOpenFileDialog.InitialDirectory = string.Format("ftp://{1}:{2}@{0}", server, userName, password);
mOpenFileDialog.ShowDialog(this);
Be careful using the username password because if they are wrong the dialog will ask the user for a username password in a pop up
|
|
|
|
|
no, it doesn't work, I am still getting the my local C;/ directory when the OpenFileDialog popups, I am going through each line in the code, and everything is going smoothly, but when I am expecting to see the requested ftp directory, I am still getting my locak C:/ directory
|
|
|
|
|
Can you post some code? Where you set the dialogs initial directory?
|
|
|
|
|
so it is something like this:
I have a button for retrieving files from FTP directory and here is the code what I have in the button click event:
OpenFileDialog dialog = new OpenFileDialog();
string server = "someServer";
string username = "someUser";
string password = "somePass";
dialog.InitialDirectory = string.Format("ftp://{1}:{2}@{0}", server, username, password);
dialog.ShowDialog(this);
|
|
|
|
|
|
This should work. If the user name and password are wrong it should prompt you for them
Did you step thru the code with the debugger and see whether the initial dir is being set?
|
|
|
|
|
yep, it shows me. Initial Directory is:
"ftp://myUserName:myPassword@myFTPaddress"
|
|
|
|
|
Ok are you sure you are not setting it again after that??
|
|
|
|
|
no..after that I have just ShowDialog(), and I have the OpenFileDialog displayed
|
|
|
|
|
Hi i am creating a form in this form i want to add a line so that at design time while i am designing the form but i did not find any contro to add to my form How i can do this
wasim khan
|
|
|
|
|
Your best bet is to handle the paint event and draw a line on the form
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here's how:- Add a Label control to your form
- Set its "BorderStyle" property to Fixed3D
- Set its "Text" property to an empty string (or null)
- Clear the "Autosize" property
- Set the control's height (or width) to 2, depending on whether you want a horizontal or vertical line.
/ravi
|
|
|
|
|
i got my answere
Just Draw a group and make it Height to 2 with no Text
it will draw a horizontal line
wasim khan
|
|
|
|
|
wasimsharp wrote: Just Draw a group and make it Height to 2 with no Text
Actually, that doesn't render as well as a Label (see my earlier reply). If you look closely at the R edge, you'll see a few bad pixels.
/ravi
|
|
|
|
|
k thanx Ravi it really help its looking nice then my one
wasim khan
|
|
|
|
|
You might consider, if you have the time, to write your own small custom line control. Then it will be painted exactly how you want with the styling that you want and it will not be messed up by any OS visual styles. However, it seems like most programmers suggest the label routine mentioned previously, I find that creating a new control adds your own custom touch to your applications.
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
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
My code is serializing a generic list of objects of class IOExtension. The IOExtension has two properties :
string Name
object Value
The serialization occurs without issue and provides the following XML:
<Culture>
<CodeCulture xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GlobalExtensions>
<CultureItemOfIOExtension ID="" Type="MyNamespace.MyClass.IOExtension, MyNamespace.MyClass, Version=2.0.0.0, Culture=neutral, PublicKeyToken=03604d72884e7711">
<IOExtension>
<Name>GlobalExtensions</Name>
<Value xsi:type="xsd:string">GlobalValue</Value>
</IOExtension>
</CultureItemOfIOExtension>
</GlobalExtensions>
</CodeCulture>
</Culture>
This is all great, except when I go to deserialize the XML I get an exception on the Value property:
Namespace prefix 'xsd' is not defined.
Now I've done some testing and it appears that this does not occur when I serialize a single instance of the IOExtension object. This would appear to be an issue with serializing the generic list of objects but I'm not sure. I've thought about implementing System.Xml.Serialization.IXmlSerializable but I'm not sure how to go about serializing the object itself. Any suggestions or thoughts out there ?
I'm hoping that I can define the namespace manually somehow but obviously my knowledge of Xml Serialization is limited.
|
|
|
|
|
Your xmlns attributes MUST be on the root element.
|
|
|
|
|
Hey Leppie, thanks for the response. I tried your suggestion but, unfortunately the following Xml deserialied with the same error:
<?xml version="1.0" encoding="utf-8"?>
<!--CodeCulture Culture File-->
<!--Created: 6/27/2008 8:27:23 AM-->
<!--Version: 1.0.0.0, Culture=neutral, PublicKeyToken=null-->
<!--Server: ISI-MBLDEV111-->
<CodeCulture xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Sample</Name>
<Version>1.0</Version>
<GlobalExtensions>
<CultureItemOfIOExtension ID="" Type="IOExtension, Component, Version=2.0.0.0, Culture=neutral, PublicKeyToken=03604d72884e7711">
<IOExtension>
<Name>GlobalExtensions</Name>
<StringValue>GlobalValue</StringValue>
<Value xsi:type="xsd:string">GlobalValue</Value>
</IOExtension>
</CultureItemOfIOExtension>
</GlobalExtensions>
</CodeCulture>
|
|
|
|
|
My delete button doesnt work.
protected void bn_delete_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
int StaffID = Int32.Parse(GridView1.DataKeys[row.RowIndex].Value.ToString());
SqlCommand cmd = new SqlCommand("DELETE FROM Staff Where StaffID = '" + row.RowIndex + "'");
lb_msg.Text = "Record Deleted Successfully.";
GridView1.EditIndex = -1;
GridView1.DataBind();
}
}
|
|
|
|
|
I suggest you do some reading. I don't see any code here that actually calls your command, let alone associates it with a database. Is this the first time you've tried to write DB code ? There's tons of examples on the web, any example on how to use a SqlCommand will do.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
My code is....
DataTable TableTemp=new DataTable();
if (dt.Rows.Count>0)
{
TableTemp.Columns.Add("Name");
TableTemp.Columns.Add("Send_date");
TableTemp.Columns.Add("Numbercurrent");
for(int iCounter=0;iCounter<dt.rows.count;icounter++)>
{
//Dua DL vao Table
DataRow row=TableTemp.NewRow();
row["Name"]=dt.Rows[iCounter]["Name"];
row["Send_date"]=dt.Rows[iCounter]["Send_date"];
row["Numbercurrent"] =xl.Checkdate(DateTime.Parse(dt.Rows[iCounter]["Send_date"].ToString(),DateTime.Now);
TableTemp.Rows.Add(row);
}
}
I want to create Datatable sorted by Numbercurrent but error message Numbercurrent field not exist....
DataTable dtsort = TableTemp.Clone();
foreach (DataRow dr in TableTemp.Select("", "order by Numbercurrent Desc"))
{
dtsort.ImportRow(dr);
}
Please help me solve my problem
|
|
|
|
|
Look into the DataView class
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
I try...
Dataview dv=new Dataview(TableTemp);
dv.sort="order by Numbercurrent desc";
Error message Numbercurrent field no exist ?
Please help me solve my problem
|
|
|
|
|
Hi All,
I'm using SQL Compact 3.5 and LINQ to use a local database in an application. I've automated a process to check that the database exists and is readable before letting the app continue, but I'm now stuck on the best way to implement some form of syncronisation making sure that the database is the right shape.
I'd like to have a class that is able to add or remove tables and columns basically ... a process to make sure that the database matches the context.
What is driving this is that future versions of my application may require amendments to the database and rather than having users go through the process of completely rebuilding the contents of the database it would be much better to have the database altered to match the new context included in the datalayer dll ...
Thanks in advance,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|