|
hello
can anybody help me with a combo box.
I want, when I run my application to see first value of the collection in the combo box, and I want to select only the value from collection, I don't want to allow to write any other value.
10x
|
|
|
|
|
Plz try it.
dropDownStyle property to DropDownList
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hi..
I dont know if i understood you correctly...
i´m from brazil..
well.. to see fist value of the collection, add this code on "Form_Load"
comboBox1.SelectedIndex = 0;
To don´t allow to write, change the proprieties "DropDownStyle" to DropDownList..
thats it...
|
|
|
|
|
set the dropDownStyle property to DropDownList
|
|
|
|
|
Go from SystemInformation.PrimaryMonitorSize to int x, int y
I have done this by evaluating the string one character at a time but I am sure there is some easy way of which I am not aware.
|
|
|
|
|
Hello,
electriac wrote: I am sure there is some easy way
Yes
use the members of this property.
SystemInformation.PrimaryMonitorSize.Height;
SystemInformation.PrimaryMonitorSize.Width;
All the best,
Martin
|
|
|
|
|
Thanks that should have been obvious but I'm getting to the point where I can plead senility.
|
|
|
|
|
electriac wrote: I'm getting to the point where I can plead senility.
humor is allways a good recipy
|
|
|
|
|
Hi..
I´m from Brazil...
I have an application (C#) that initializes on the "system tray"...
I´d like to show some form from this application when time gets 3:00PM, for example...
but, i´d like that the form "jump" into the screen... without click a button...
that´s it..
sorry about the bad english..
thanks!
Carlos A. Velloso Jr
|
|
|
|
|
make your application as service which check periadically for the specific time and show on system tray.
or your make an exe which shedule in windows shedulin job on 3 pm
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
You can also create an application with a timer. This application will reside only in the tray and when the desired time or any other condition has been met it will show a new form on the dekstop.
|
|
|
|
|
This is one way of doing it:
private void Form1_Load(object sender, EventArgs e)
{
TimeSpan startTime = new TimeSpan(13, 40, 0);
TimeSpan currentTime = DateTime.Now.TimeOfDay;
TimeSpan diff = startTime - currentTime;
if (diff.Ticks > 0)
{
timer1.Interval = (int)diff.TotalMilliseconds;
timer1.Start();
}
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Stop();
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
}
|
|
|
|
|
hi all
i try to save a 4bpp bitmap in an memorystream.
example:
// Clone the original 4bpp bitmap
Bitmap bmp = (Bitmap)image.Clone();
using(MemoryStream ms = new MemoryStream())
{
bmp.Save(ms, ImageFormat.Bmp);
}
bmp.Dispose();
this code give me the following error: Error in GDI+
this code works fine but it convert the bitmap to a 32bpp format:
using(Bitmap bmp = new Bitmap(image))
{
using(MemoryStream ms = new MemoryStream())
{
bmp.Save(ms, ImageFormat.Bmp);
}
}
it is possible to save a 4bpp bitmap to a stream?
regards
JoeSharp
|
|
|
|
|
I havent tried this, but from earlier posts on these message boards, I have got the impression
Save only works for pixels that take 8 or more bits, not for 1 or 4 bits per pixel.
And that is a pitty.
Luc Pattyn
|
|
|
|
|
hi
i am using VC# 2005 and sql server 2005 express.how to set Password on my database (in Sql Server 2005 Express) ?
(bacause i don't want that users access to my sql server express database.)
thanks.
|
|
|
|
|
i have programmatically set NTFS file system folder permissions by using Active Directory Service Interfaces in Microsoft Visual C#.the problem is that i give permissions through Mohana//administrator(Domin/User) to (C:\\Test) Folder. the program works but when i right click the test folder goto Security Tab it create another user (BUILTIN//BUILTIN)and give All permition to it. i want all permission to administrator. Plz help me.
...code....
using System;
using System.Security;
using ADSSECURITYLib;
using ActiveDs;
namespace SecurityFolder
{
public class clsSecurity
{
public clsSecurity()
{
}
public void preformAction()
{
// Set <domain> to your domain name.
// Set <username> to the user account.
SetPermissions("C:\\Test","MOHANA\\administrator");
Console.WriteLine ("Full Access control granted.");
}
public void SetPermissions(string vPath, String UserName )
{
ADsSecurity objADsSec;
SecurityDescriptor objSecDes;
AccessControlList objDAcl;
AccessControlEntry objAce1;
AccessControlEntry objAce2;
Object objSIdHex;
ADsSID objSId;
string mes;
objADsSec = new ADsSecurityClass();
objSecDes = (SecurityDescriptor)(objADsSec.GetSecurityDescriptor("FILE://"+vPath));
//objSecDes=(SecurityDescriptor)objADsSec.GetSecurityDescriptor(vPath);
objDAcl = (AccessControlList)objSecDes.DiscretionaryAcl;
objSId = new ADsSIDClass();
objSId.SetAs((int)ADSSECURITYLib.ADS_SID_FORMAT.ADS_SID_SAM, UserName.ToString());
objSIdHex = objSId.GetAs((int)ADSSECURITYLib.ADS_SID_FORMAT.ADS_SID_SDDL);
// Add a new access control entry (ACE) object (objAce) so that the user has Full Control permissions on NTFS file system files.
objAce1 = new AccessControlEntryClass();
objAce1.Trustee = System.Convert.ToString (objSIdHex);
objAce1.AccessMask = (int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_ALL;
objAce1.AceType = (int)ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_ALLOWED;
objAce1.AceFlags = (int)ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT_ACE | (int)ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT_ONLY_ACE | 1;
objDAcl.AddAce(objAce1);
// Add a new access control entry object (objAce) so that the user has Full Control permissions on NTFS file system folders.
objAce2 = new AccessControlEntryClass();
objAce2.Trustee = System.Convert.ToString (objSIdHex);
objAce2.AccessMask = (int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_ALL;
objAce2.AceType = (int)ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_ALLOWED;
objAce2.AceFlags = (int)ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT_ACE | 1;
objDAcl.AddAce(objAce2);
objSecDes.DiscretionaryAcl = objDAcl;
// Set permissions on the NTFS file system folder.
objADsSec.SetSecurityDescriptor(objSecDes, "FILE://"+vPath);
}
}
}
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
DirectoryInfo di = new DirectoryInfo("C:\\TestDir");
DirectorySecurity dc = new DirectorySecurity();
FileSystemAccessRule ar = new FileSystemAccessRule("Administrator",FileSystemRights.FullControl,AccessControlType.Allow);
dc.AddAccessRule(ar);
di.Create(dc);
|
|
|
|
|
Hi to all....
How to invoke a exe file through asp.net application.
One thing i tried is System.Diagnostics.Process.start("exe")....
it is not working...
am doing database file download using that exe.....
thank u....
Kalyan
|
|
|
|
|
You need to provide more information than this. Are you getting any errors? If so, what are you seeing? Have you provided a fully qualified path to the executable if the executable is not in the PATH? Have you checked that you have sufficient privileges to run the process from the ASPNET worker process?
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
the exe is running in local client and downloading the file from webserver
when i double click it i getting what i need from the server...
but i use the code system.diaganostic.process.start("exe");
it is calling the exe suceesfully but download is not happened and no errors are shown.....
|
|
|
|
|
That is not the way to download a file from the server. If it was, then this would be a major security flaw and a gaping hole through which exploit attacks could occur. What you need to do is to write the file to the response stream and set the content type appropriately. Note that you cannot directly execute the program. The user has to do this.
To download the file:
private void WriteFile(string fileName)
{
try
{
Response.ContentType = "APPLICATION/OCTET-STREAM";
string header = string.Format("Attachment; Filename = \"{0}\",
Path.GetFilename(fileName));
Response.AppendHeader("Content-Disposition", header);
FileInfo download = new FileInfo(fileName);
Response.Flush();
Response.WriteFile(download.FullName);
}
catch (Exception ex)
{
//Report out any errors.
}
}
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
wrote: How to invoke a exe file through asp.net application.
One thing i tried is System.Diagnostics.Process.start("exe")....
it is not working...
am doing database file download using that exe.....
1. The executable will be run on the server. Never the client.
2. The exe will be running with the same permissions as the webserver (typically the ASPNET account) - Does this account have the rights to do this?
|
|
|
|
|
ASP code executes on the server not the client. After reading this thread I have no idea what you are doing and it is possible that you don't either.
led mike
|
|
|
|
|
the exe is running in local client and downloading the file from webserver
when i double click it i getting what i need from the server...
but i use the code system.diaganostic.process.start("exe");
it is calling the exe suceesfully but download is not happened and no errors are shown.....
|
|
|
|
|
Trying to run the following console program from a 'Sam's' Learn C# book and getting a bunch of
errors; can anyone see what might be causing these please? (I'm only a C# rookie myself.)
Error 1 A namespace does not directly contain members such as fields or methods
Error 3 Invalid token '7' in class, struct, or interface member declaration
Error 4 Invalid token '9' in class, struct, or interface member declaration
Error 5 Invalid token '10' in class, struct, or interface member declaration
Error 6 Invalid token '11' in class, struct, or interface member declaration
Error 7 Invalid token '12' in class, struct, or interface member declaration
1: // Circle1.cs - Overloading the area method
2: //--------------------------------------------------------------------
3:
4: using System;
5:
6: public class Circle
7: {
8: public int x;
9: public int y;
10: public double radius;
11: private const float PI = 3.14159F;
12:
13: public double Area() // Uses values from data members
14: {
15: return Area(radius);
16: }
17:
18: public double Area( double rad )
19: {
20: double theArea;
21: theArea = PI * rad * rad;
22: Console.WriteLine(" The area for radius ({0}) is {1}", rad, theArea);
23: return theArea;
24: }
25:
26: public double Area(int x1, int y1, double rad)
27: {
28: return Area(rad);
29: }
30:
31: public double Area( int x1, int y1, int x2, int y2 )
32: {
33: int x_diff;
34: int y_diff;
35: double rad;
36:
37: x_diff = x2 - x1;
38: y_diff = y2 - y1;
39:
40: rad = (double) Math.Sqrt((x_diff * x_diff) + (y_diff * y_diff));
41:
42: return Area(rad);
43: }
44:
45: public Circle()
46: {
47: x = 0;
48: y = 0;
49: radius = 0.0;
50: }
51: }
52:
53: class CircleApp
54: {
55: public static void Main()
56: {
57: Circle myCircle = new Circle();
58:
59: Console.WriteLine("Passing nothing...");
60: myCircle.Area();
61:
62: Console.WriteLine("\nPassing a radius of 3...");
63: myCircle.Area( 3 );
64:
65: Console.WriteLine("\nPassing a center of (2, 4) and a radius of 3...");
66: myCircle.Area( 2, 4, 3 );
67:
68: Console.WriteLine("\nPassing center of (2, 3) and a point of (5, 6)...");
69: myCircle.Area( 2, 3, 4, 5 );
70: }
71: }
|
|
|
|