|
Hi,
i created a folder and added a few icons there (i embeded them after), and i want to load them in a label only in some ocasions (other ocasions remains with no icon), the bellow code is for bitmap but not for icons! well it loads but i get edges in white color
Assembly myAssembly = Assembly.GetExecutingAssembly();
Bitmap mybit = new Bitmap(myAssembly.GetManifestResourceStream("UserControl_Page.icons.error.ico"));
Image img = Image.FromHbitmap(mybit.GetHbitmap());
ToolStripStatusLabel_InfoBottom.Image = img;
how can i do this for an icon file???
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
I am working on a SDK. It is currently for our use, but one day it will be licensed to our customers. I need a way to ensure that the only code that uses the SDK is our code. Our code is signed (Strong Name). I was thinking that it would be great if there is an Init function or Load event I could use to check that the assembly loading mine was signed with our key. Does such a thing exist? Do you have an alternative idea?
Pat O
Tanks for your support
Pat O
<a href="http://currentchaos.blogspot.com/">Blog</a>
_ _ _
|
|
|
|
|
AppDomain.AssemblyResolve
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Thanks, I was aware of that. I was hoping for something that is called on code within the assembly. Again the goal is to enforce licensing, therefore relaying on someone to register my licencing code prior to using my SDK seems unlikely to work. I guess I could ask the more general question how do others handle licensing?
Tanks for your support
Pat O
<a href="http://currentchaos.blogspot.com/">Blog</a>
_ _ _
|
|
|
|
|
Hi All,
I m using a windows service for calling a web service to insert some data in Db in set interval. When i run exe of my windows service, everything is working perfectly, but when i m creating setup of windows service and deploying it, its not updating data in DB. I don't know the problem with setup. I m using installer in windows service and added custom actions in setup. Even setup if installing as expected and running the service after installation it, but after that i can't see any changes in my data.
Can any one help me in this issue.......
Thanks in advance
|
|
|
|
|
You have to narrow down where the problem is. Is it in calling the Web Service? Is it connecting to the database?? Is it in calling the database functions?? There's too many places to list.
But, I'll take an educated guess at it and say that you used a Trusted Connection to the database, correct? Since services are, by default, run under the Local System account, the SQL server doesn't trust it, so, the connection fails. It's better to use an SQL account that is specificly used by your service to log into the database.
|
|
|
|
|
HI
Can anybody help me i wrote the following code in Console application. Now i want to convert it in Method GetContact(String TeamName). i want to call it from Aspx page. It will get the parameter TeamName and pass it to my SQL Where Clause statement. After the following code will generate the xml and save the file c:temp. RightNow it is working fine but only in Console Application. How i can use this code in MY_FOR_CONTACT(string TeamName). I want to give this code to front end developer who use it to create xml file everytime. and save it c:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
class ExecuteXmlReader
{public static void Main(){
String TeamName = "gta";
String sConnection = "server=HTCWEBDEMO;database=hometrust;user id=ht_admin;password=htc_tr!st";
//String sConnection = "server=zjaffary\\SQLExpress;Integrated Security=SSPI;database=northwind";
SqlConnection mySqlConnection = new SqlConnection(sConnection);
mySqlConnection.Open();
// Get the same data through the provider.
string mySQLStatement = "SELECT Title,FirstName,LastName,PhoneNumber,Faxnumber, email from contactlist where TeamName='" + TeamName +"'; select FirstName, LastName from contactlist where TeamMorty ='True' and teamname='" + TeamName + "';";
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySQLStatement, sConnection);
//SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter("SELECT FirstName,LastName,Title,City from employees; select city from employees;", sConnection);
DataSet myDataSet2 = new DataSet();
myDataSet2.DataSetName = "Contacts";
mySqlDataAdapter.Fill(myDataSet2);
// Write data to files: data1.xml and data2.xml for comparison.
myDataSet2.WriteXml("c:/temp/ContactList.xml");
mySqlConnection.Close();
}
}
|
|
|
|
|
In ASP.NET you have to have permissions to write to the file system. Usually you do not want to allow permission to write to the root, or C, and instead want to write the file to a directory within the site root. Assign read/write permissions to the directory from the IIS snap-in and assign the permissions using the Windows Explorer.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: In ASP.NET you have to have permissions to write to the file system.
Logically, whilst translating this, he ought to replace that with Response.WriteFile() right>?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
That is only if he wishes to output the file to the web user. In his example the file is written to the local file system thus Response.WriteFile would be inappropriate. But then his code requires a lot of inferring so I cannot claim to know exactly what he wants.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Create a folder with ASP.Net and NetworkService user with read/write permission. Not the best way to do this but will work.
|
|
|
|
|
Thanks for your reply. I have done what i was trying to do. But now have another issue. May be you can help for that. it is about the xml file output when it created it showing TABLE and TABLE1 as node in xml how i can change it to meaningful name. My Code is as follows. XML file is at the bottom of the code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
public partial class _Default : System.Web.UI.Page
{protected void Page_Load(object sender, EventArgs e){
GetEmployees("London");
}
public static void GetEmployees(string City){
//String sConnection = "server=HTCWEBDEMO;database=hometrust;user id=ht_admin;password=htc_tr!st";
String sConnection = "server=ZAFAR-PC\\SQLEXPRESS;Integrated Security=SSPI;database=northwind";
SqlConnection mySqlConnection = new SqlConnection(sConnection);
mySqlConnection.Open();
// Get the same data through the provider.
//string mySQLStatement = "SELECT Title,FirstName,LastName,PhoneNumber,Faxnumber, email from contactlist where TeamName='" + TeamName +"'; select FirstName, LastName from contactlist where TeamMorty ='True' and teamname='" + TeamName + "';";
string mySQLStatement = "SELECT FirstName,LastName,Title,City from employees where city= '" + City + "';select FirstName, LastName from employees where city='" + City + "';";
//SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySQLStatement, sConnection);
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySQLStatement, sConnection);
DataSet myDataSet2 = new DataSet();
myDataSet2.DataSetName = "Contacts";
mySqlDataAdapter.Fill(myDataSet2);
// Write data to files: data1.xml and data2.xml for comparison.
myDataSet2.WriteXml("c:/temp/ContactList.xml");
mySqlConnection.Close();
}
}
XML FILE OUTPUT
<?xml version="1.0" standalone="yes" ?>
- <Contacts>
- <Table>
<FirstName>Steven</FirstName>
<LastName>Buchanan</LastName>
<Title>Sales Manager</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Michael</FirstName>
<LastName>Suyama</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Robert</FirstName>
<LastName>King</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Anne</FirstName>
<LastName>Dodsworth</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table1>
<FirstName>Steven</FirstName>
<LastName>Buchanan</LastName>
</Table1>
- <Table1>
<FirstName>Michael</FirstName>
<LastName>Suyama</LastName>
</Table1>
- <Table1>
<FirstName>Robert</FirstName>
<LastName>King</LastName>
</Table1>
- <Table1>
<FirstName>Anne</FirstName>
<LastName>Dodsworth</LastName>
</Table1>
</Contacts>
|
|
|
|
|
Try changing the name of the tables:
MyDataSet2.Tables[0].Name = "First Table";
MyDataSet2.Tables[1].Name = "Second Table";
You should be able to rename the tables in the collection.
|
|
|
|
|
I have a method that basically takes a response stream and saves it to a file. This works fine. I want to be able to add a resume feature to this method.
Any suggestions?
My method:
private void WriteToFile(Stream response, Stream output, long sz)
{
if (sz == 0)
{
return;
}
byte[] buffer = new byte[1024 * 64];
long read = 0;
long totalRead = 0;
while ((read = response.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, Convert.ToInt32(read));
totalRead += read;
output.Flush();
}
}
|
|
|
|
|
You have to require the stream to be a seakable stream and then you can just set the position of the stream using the Position property.
Also, don't flush on each write.
byte[] buffer = new byte[1024];
int read = 0;
inputStream.Position = 0;
while((read = inputStream.Read(buffer, 0, buffer.Length)) != 0) {
outputStream.Write(buffer, 0, read);
}
outputStream.Flush();
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
1) The response stream is not seekable since it is a WebResponse.GetResponseStream(). What is my other option?
2) Why is it not a good idea to flush at every write?
|
|
|
|
|
Writing to the stream is controlled by an underlying algorithm, there is no need to flush since it forces the write which may be inefficient. If you want resume downloads using .NET you will probably have to write your own resume code based on the specification of the underlying protocol.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
This works the way it should. I havnt optimized it, so if you want to use this code, look it over and clean it up.
Read the comments. Suggestions are appreciated. Im working on optimizing my code. Too sleepy to do it today.
public void DownloadFile(System.Uri url, string filePath, long sz)
{
Stream r = null;
Stream output = GetFileStream(filePath);
System.Net.WebRequest request = System.Net.WebRequest.Create(url);
System.Net.HttpWebRequest hrequest = (System.Net.HttpWebRequest)request;
hrequest.AddRange(Convert.ToInt32(w.Length));
hrequest.UserAgent = "Mozilla/4.0 (compatiable; MSIE 7.0; Windows NT 6.0)";
System.Net.WebResponse response = null;
try
{
using (response = request.GetResponse())
{
using (r = response.GetResponseStream())
{
using (output)
{
WriteToFile(r, output, sz, w.Length);
}
}
}
}
catch (Exception ex)
{
File.Delete(filePath);
throw new Exception("Could not save " + url, ex);
}
finally
{
}
}
private Stream GetFileStream(string filePath)
{
string fileDirectory = filePath.Substring(0, filePath.LastIndexOf(@"\"));
if (!Directory.Exists(fileDirectory))
Directory.CreateDirectory(fileDirectory);
if (File.Exists(filePath))
return File.Open(filePath, FileMode.Append);
else
return File.Create(filePath);
}
private void WriteToFile(Stream response, Stream output, long sz, long initSize)
{
DateTime startTime = DateTime.Now;
if (sz == 0)
return;
byte[] buffer = new byte[1024 * 64];
long read = 0;
long totalRead = initSize;
while ((read = response.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, Convert.ToInt32(read));
}
w.Flush();
}
|
|
|
|
|
Thanks for your reply. I have done what i was trying to do. But now have another issue. May be you can help for that. it is about the xml file output when it created it showing TABLE and TABLE1 as node in xml how i can change it to meaningful name. My Code is as follows. XML file is at the bottom of the code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
public partial class _Default : System.Web.UI.Page
{protected void Page_Load(object sender, EventArgs e){
GetEmployees("London");
}
public static void GetEmployees(string City){
//String sConnection = "server=HTCWEBDEMO;database=hometrust;user id=ht_admin;password=htc_tr!st";
String sConnection = "server=ZAFAR-PC\\SQLEXPRESS;Integrated Security=SSPI;database=northwind";
SqlConnection mySqlConnection = new SqlConnection(sConnection);
mySqlConnection.Open();
// Get the same data through the provider.
//string mySQLStatement = "SELECT Title,FirstName,LastName,PhoneNumber,Faxnumber, email from contactlist where TeamName='" + TeamName +"'; select FirstName, LastName from contactlist where TeamMorty ='True' and teamname='" + TeamName + "';";
string mySQLStatement = "SELECT FirstName,LastName,Title,City from employees where city= '" + City + "';select FirstName, LastName from employees where city='" + City + "';";
//SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySQLStatement, sConnection);
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySQLStatement, sConnection);
DataSet myDataSet2 = new DataSet();
myDataSet2.DataSetName = "Contacts";
mySqlDataAdapter.Fill(myDataSet2);
// Write data to files: data1.xml and data2.xml for comparison.
myDataSet2.WriteXml("c:/temp/ContactList.xml");
mySqlConnection.Close();
}
}
XML FILE OUTPUT
<?xml version="1.0" standalone="yes" ?>
- <Contacts>
- <Table>
<FirstName>Steven</FirstName>
<LastName>Buchanan</LastName>
<Title>Sales Manager</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Michael</FirstName>
<LastName>Suyama</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Robert</FirstName>
<LastName>King</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Anne</FirstName>
<LastName>Dodsworth</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table1>
<FirstName>Steven</FirstName>
<LastName>Buchanan</LastName>
</Table1>
- <Table1>
<FirstName>Michael</FirstName>
<LastName>Suyama</LastName>
</Table1>
- <Table1>
<FirstName>Robert</FirstName>
<LastName>King</LastName>
</Table1>
- <Table1>
<FirstName>Anne</FirstName>
<LastName>Dodsworth</LastName>
</Table1>
</Contacts>
|
|
|
|
|
Don't post a new question as a reply in a completely unrelated thread.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I download the CaptureAndPrintMSChart project (http://www.codeproject.com/KB/cpp/capture_and_print_mschart.aspx) & tried, the MsChart working fine but when I try to print, I have the error
MSChart.EditCopy();<br />
Bitmap chartCapture = (Bitmap) Clipboard.GetDataObject().GetData("Bitmap", true);<br />
chartCapture.Save("Image.Jpeg");
- The error says that: The ExecutionEngineException was unhandled
By the way, I use the Visual Studio 2005 (Prof.), I think that is the reason (it did converted before I ran the project)
Can someone show me how to modify it?
Thank for any help
modified on Friday, October 24, 2008 3:48 PM
|
|
|
|
|
i'm trying to capture the screen when i'm playing video but when i run the code it capture the entire screen but the video region always black. It works fine in Vista but in windows XP it do the black video region problem. I have tried several ways but always same problem. Some of them are :
[DllImport("user32.dll")]
private static extern IntPtr keybd_event(int key, int dummy, int flags, IntPtr info);
keybd_event(0x2c, 0, 0, IntPtr.Zero);
Application.DoEvents();
Image tmp_I = Clipboard.GetImage();
tmp_I.Save(filePath);
Bitmap tmp_B = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(tmp_B);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.PrimaryScreen.Bounds.Size);
tmp_B.Save(filePath);
any idea guys ?
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
As i type text in MultiLineStringEditor it expands horinontally so is there a way to control the width of the MultilineStringEditor when text is being entered. I couldn't find anything resourcesful hope gurus can help me out here.
[Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
public override string StringProp
{
get{ return base.StringProp; }
set{ base.StringProp= value; }
}
|
|
|
|
|
DirectoryEntry employee = result.GetDirectoryEntry();
string ea = employee.Properties["proxyAddresses"].Value.ToString();
MessageBox.Show(ea.ToString());
Hi All,
i'm using the above code to try and extract the email address of a user account. if i swap proxyAddresses for 'description' or 'employeeID' etc it works fine. but when i use proxyAddresses it errors!
i have tried creating ea as a string array and it still fails!!
any ideas?
many thanks,
Phil
|
|
|
|
|
|