|
Hi,
How To change a user's group or account type in c# (or command line)?
|
|
|
|
|
hi all,
I need to hide Windows console Application.
How Can I do it?
Main Method is Like this:-
[STAThread]
static void Main(string[] args)
{
CTService lobjFareReference=new CTService();
try
{
lobjFareReference.ExecuteProcess();
}
catch(Exception exception)
{
System.Diagnostics.Debug.Write(exception);
throw;
}
}
When I execute Main, A Black DOS Screen PopUp .Now I need to hide that screen..
How can I do it?
thanks in Advance..
|
|
|
|
|
Change your console app's Output Type (in the Application tab in Project Properties) to "Windows Application". Since you used the Console Application template when you created your project, it will still be a non-GUI app, but since you set the Output Type to Windows Application, no console window will be shown.
|
|
|
|
|
I'm currently working on a kind of custom FTP client. It's not really an FTP client from a user perspective, but from a backend perspective it most certainly is.
Specifically, what the program does is logs in to an FTP server, uploads one file, downloads another and then exits, giving the user the contents of the downloaded file (plain text).
I put something together in the space of only a few hours using System.Net.FtpWebRequest and testing was fine with my real FTP server. When it came to testing it in the real world however, I ran in to a couple of hiccups.
The FTP server my program connects to is VERY stripped down (as it's really only designed for this one specific task, not a general purpose FTP server) and doesn't accept the majority of standard FTP commands. A quick Ethereal trace of my program running showed that it connected okay, but died shortly after login - the FTP server isn't expecting what the client gives it at login (a couple of fairly standard commands) and instead of just ignoring it, it falls over and refuses to go any further.
SO - after all that explanation, my question is whether it's possible to and how I would go about stripping down the FTP client to ONLY send:
1) USER <username> (no password)
2) TYPE I
3) PORT <abc>
4) STOR <filename1>
5) PORT <xyz>
6) GET <filename2>
7) QUIT
Attempting to send anything else at all will cause this FTP server to fall over (no, I have no choice in the matter of the FTP server - it's in an embedded device).
(and if I can avoid having to do the PORT side of things manually, that'd be a plus too - but only out of laziness! I'll do it if I have to.)
If it's not possible to strip down the FTP client side of it, I could alternatively approach it from the other direction and do it without using System.Net.FtpWebRequest at all, in which case I'd REALLY appreciate some pointers or example code on writing an FTP client from the ground up in C#.
Any help would be greatly appreciated.
Regards,
Ben.
|
|
|
|
|
I have the following problem.
Say, that I have a class called Point which has x,y and the distance from (0,0).
There are two constructors, one take all three values and the other take only x ,y.
I subclass this to a circle class which has its own radius and distance from (0,0). To initialize I want to use two different constructor that use either of the base class constructors.
This causes an error in the program. Why is that, is there any solution
Check the following code and the error msg.
// Point3 class represents an x-y coordinate pair.
using System;
namespace CylinderTest
{
// Point3 class definition implicitly inherits from Object
public class Point3
{
// point coordinate
int x, y;
// default constructor
public Point3()
{
// implicit call to Object constructor occurs here
}
// constructor
public Point3( int xValue, int yValue )
{
// implicit call to Object constructor occurs here
X = xValue;
Y = yValue;
}
// property X
public int X
{
get
{
return x;
}
set
{
x = value; // no need for validation
}
} // end property X
// property Y
public int Y
{
get
{
return y;
}
set
{
y = value; // no need for validation
}
} // end property Y
// return string representation of Point3
public override string ToString()
{
return "[" + X + ", " + Y + "]";
}
} // end class Point3
}
// Circle4 class that inherits from class Point3.
using System;
namespace CylinderTest
{
// Circle4 class definition inherits from Point3
public class Circle4 : Point3
{
private double radius;
// default constructor
public Circle4()
{
// implicit call to Point constructor occurs here
}
// constructor
public Circle4( int xValue, int yValue, double radiusValue )
: base( xValue, yValue )
{
Radius = radiusValue;
}
// constructor
public Circle4( int xValue, int yValue )
: base( xValue, yValue )
{
}
// property Radius
public virtual double Radius
{
get
{
return radius;
}
set
{
if ( value >= 0 )
radius = value;
}
} // end property Radius
// calculate Circle diameter
public double Diameter()
{
return Radius * 2;
}
// calculate Circle circumference
public double Circumference()
{
return Math.PI * Diameter();
}
// calculate Circle area
public virtual double Area()
{
return Math.PI * Math.Pow( Radius, 2 );
}
// return string representation of Circle4
public override string ToString()
{
// use base reference to return Point string representation
return "Center= " + base.ToString() +
"; Radius = " + Radius;
}
} // end class Circle4
}
// Cylinder class inherits from class Circle4.
using System;
namespace CylinderTest
{
// Cylinder class definition inherits from Circle4
public class Cylinder : Circle4
{
private double height;
private double radius;
// default constructor
public Cylinder()
{
// implicit call to Circle4 constructor occurs here
}
// four-argument constructor
public Cylinder( int xValue, int yValue, double radiusValue,
double heightValue ) : base( xValue, yValue, radiusValue )
{
Height = heightValue; // set Cylinder height
}
// four-argument constructor
public Cylinder( int xValue, int yValue, double radiusValue,
double heightValue ) : base( xValue, yValue )
{
Height = heightValue; // set Cylinder height
Radius = radiusValue;
}
// property Height
public override double Radius
{
get
{
return height;
}
set
{
if ( value >= 0 ) // validate height
height = value;
}
} // end property Height
// property Height
public double Height
{
get
{
return height;
}
set
{
if ( value >= 0 ) // validate height
height = value;
}
} // end property Height
// override Circle4 method Area to calculate Cylinder area
public override double Area()
{
return 2 * base.Area() + base.Circumference() * Height;
}
// calculate Cylinder volume
public double Volume()
{
return base.Area() * Height;
}
// convert Cylinder to string
public override string ToString()
{
return base.ToString() + "; Height = " + Height;
}
} // end class Cylinder
}
lOOK FOR THE MULTIPLE CONSTRUCTORS IN CYLINDER AND CIRCLE THIS WILL NOT COMPLITE
ERROR
Class 'CylinderTest.Cylinder' already defines a member called 'Cylinder' with the same parameter types
A. Miftha Idroos
B.Sc. Engineering, AMBCS, AMIE(SL)
Hatton National Bank,
Sri Lanka
-- modified at 1:20 Monday 20th February, 2006
|
|
|
|
|
Standard question #2:
What error message do you get?
Standard question #3:
What does your code look like?
---
b { font-weight: normal; }
|
|
|
|
|
miftha wrote: // default constructor
public Cylinder()
{
// implicit call to Circle4 constructor occurs here
}
Oh no it doesnt!!
public Circle4():base()
<br />
{<br />
}
-- modified at 3:35 Monday 20th February, 2006
|
|
|
|
|
If you want two different constructors they have to have different parameters. What you have now is two constructors with the same parameters that do the same work, so I don't even see the reason for having both of them.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I'm binding an ArrayList of Structures to the DataGrid. The Arraylist is binded to the Datagrid but the column sequence changes (ie. the column sequence in the SP and the column sequence in the Datagrid differs). I'm using Datareader to fill the ArrayList and then bind it to the Grid. Can anyone tell me how to maintain the same column sequence in Datagrid as in the SP.
Regards,
Shah Adarsh.
|
|
|
|
|
I have to paint the menu background...
I alredy have a dll which sets the .net style for menu's.
This I want to do with toolbar. To paint just a background.
I want to do all this to match the GUI.
All other controls are in different colors. I want to paint this two controls (perhaps statusbar, but it's not very important) in more appropriate color to match the other controls.
Can I somehow paint the toolbar background, but to keep the buttons drawn by the OS?
I've asked Google, but no luck.
-- modified at 11:35 Monday 20th February, 2006
|
|
|
|
|
Hi,
I was wondering if Visual Studio 2003 supports reading XML file generated by saving Word Document 2003 as XML?
I was trying to read word doc xml into an empty dataset just like a regular xml file but DuplicationNameException error persists. The word XML is basically well-formed but the data view for the xml is unable to display the structures.
Could someone help explain to me the reason why? Im still working on Visual Studio 2003 and if this is a new feature of word document 2003 that is not supported in VS2003, then I have no choice but to acquire VS2005.
My goal is to be able to load a word document xml in a server (maybe sql server) and then be able to read back that xml, load into a dataset, display in a view keeping all the formatting properties of the contents of the word document.
If anyone has any idea to do this within the boundary of the Visual Studio and C#, I would really appreciate the help.
Thanks so much!
Teddy
|
|
|
|
|
Create a Microsoft Word document using MS Word editor. Apply your formatting, font & paragraph styles, page setup, etc. When you save your file, specify "Xml" as the file type. Now exit Word and open the WordML (XML) file in Notepad. See how and where the data is placed. You'll simply have to write an XSLT which takes in an XML (documnet) data and produces the output -- similar to what MS Word produced.
- Malhar
|
|
|
|
|
I've never used the datasets and tableadapters in visual studio before and I'm having some trouble trying to figure them out. Right now it's going like this. I have a strongly-typed dataset on my form, I also have a bindingsource that's bound to the dataset and my database table, this created a tableadpater for me. Now because some columns in the database are just id's that the user doesn't need to know about I don't have controls for them on my form. My question is how to I update this information in the dataset so that it's populated back to the database? I'm trying something like this, but I know it's not right.
Guid guid = Guid.NewGuid ();
myDataSet.myDataTable table = myTableAdapter.GetData ();
table.idColumn = guid.ToString ("N");
myBindingSource.EndEdit ();
myTableAdapter.Update (this.myDataSet.eps); I think the basic question is how to I update/insert/delete on a strongly-typed datatable from within code?
Thanks for any and all help
- Aaron
|
|
|
|
|
Hello, how can i make a C# function throw a certain exception? Thanks very much!
|
|
|
|
|
If you didn't write the function (i.e. if you can't change the source code), you cannot change what exceptions it throws, all you can do is throw whatever seems appropriate to you based on what the function returns.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If you have written the function, to throw an exception you do this:
<br />
private void someFunction()<br />
{<br />
throw (new Exception());<br />
}<br />
But adjust the type of exception accordingly.
Is that what you wanted?
Hope that helps.
|
|
|
|
|
'throw (new Exception());' must be inside the function block:
openFileClicked() { throw (new Exception()); }
|
|
|
|
|
I am doing a project for school I have to wirte a code for a login page if the user enters a vaild username and passwrd is should tell me how much is in my back accouont if the login is invalid it should say invalid password I am using visual studio can anyone help me
Heather
|
|
|
|
|
Hi, Heather. I'm sure tons of people here can help you, but first you need to ask a question. Right now, this looks suspiciously like 'do my homework for me', which is a whole different story. Is this a windows application ? That is, do you need a login *dialog*, or will the login just appear as text in a scrolling window ? If the former, then you need to start by creating a login dialog. If the latter, then the job is trivial, you just need to accept input, check a password/username combo and print some number. In either case, you should start doing your own homework, and ask some questions when you're stuck on specifics, and have some code to post so we can see what's going on and help from there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
it is a windows application I am not asking anyone to do my homework I am asking for a helping hand to get it started, I am not sure how to get it to look for the correct usernames and passwords
Heather
|
|
|
|
|
this is what I have so far but I know it is not right
cant figure out how to fix it
int lgflg = 0;
SqlConnection conn =
new SqlConnection( ConfigurationSettings.AppSettings["DSN"].ToString() );
SqlCommand cmd =
new SqlCommand("SELECT ID From [User_tbl] Where Pass = '" + Pass.Text
+ "' And Login = '" + Login.Text + "'",conn);
conn.Open();
SqlDataReader myReader = cmd.ExecuteReader();
while (myReader.Read()) {
lgflg = 1;
}
myReader.Close();
conn.Close();
if (lgflg == 1) {
Response.Redirect("default.aspx");
}
Heather
|
|
|
|
|
To make things a little easier to read you could rewrite it like this:
<br />
bool validAccount = false;<br />
<br />
SqlConnection conn = new SqlConnection( ConfigurationSettings.AppSettings["DSN"].ToString() );<br />
SqlCommand cmd = new SqlCommand("SELECT ID FROM User_tbl WHERE Pass = \'" + Pass.Text + "\' AND Login = \'" + Login.Text + "\'",conn);<br />
<br />
conn.Open();<br />
<br />
if(cmd.ExecuteNonQuery() > 0)<br />
{<br />
validAccount = true;<br />
}<br />
<br />
conn.Close();<br />
<br />
if (vaildAccount) <br />
Response.Redirect("default.aspx");<br />
else<br />
Response.Write("Authentication Failed.");<br />
Were you getting an error with the code you wrote It seems ok.
|
|
|
|
|
You can use Hashing algos to create user passwords and compare your login infos with the hashed ones.
Enjoy coding
|
|
|
|
|
This is awful advice for the posted homework question.
1!
|
|
|
|
|
Hi! I really don't know why I get this error--> System.Runtime.InteropServices.COMException everytime i try to import excel files into my application. When I tried using the sample code directly calling it from the main function, it worked. But when I put the sample code in an area where the user will be the one to choose if he/she wants to import excel files or not, I have that error...I really don't understand why... Thanks!
|
|
|
|