|
Are you using any kind of unmanaged code in your VB.Net app.
(any API call or COM components ?)
Is there any kind of loop in your vb.net dll?
Any hardware resources is needed?
Can you debug your program?
|
|
|
|
|
There are COM components.
I ave not tried to run debug.
|
|
|
|
|
Got it!
I had a thread that needed to be aborted in the Dispose method of the VB.Net code.
Thanks for pointing me in the right direction!
|
|
|
|
|
I have an application (c#) that runs on a Windows 2000 Terminal Server.
I have various popup screens that can be closed by pressing CTL + ENTER.
These don't work on the terminal server, but they do work on any standalone computer. Any thoughts?
Paul Brower
|
|
|
|
|
You need to configure your Terminal Services Client. If you are using Remote Desktop (mstsc.exe) in XP, Setup new connection to your TS, then go to Local Resources Tab -> Keyboard section and pick "On Remote Computer" for Apply Windows Key Combinations option.
|
|
|
|
|
I did not get any answers the last time, so I thought that I would try again.
I need to do an automated form based post where I will post to another .aspx page over a secure https url. In the form post will be 9 fields of data that are text and one which is a binary file.
A NameValueCollection works like a charm for just the text input fields, but I can not seem to include the file which needs to be a binary format. The NameValueCollection expects a string value for the key pairs. I have examined what .Net provides as far as UploadData, UploadFile and UploadValues. I am using UploadValues because of the NameValueCollection.
Any suggestions on how to post everything at one time? Thanks in advance.
My code is:
int FileLen = this.Filepath.PostedFile.ContentLength;
byte[] FileBinaryData = new byte[FileLen];
HttpPostedFile theFile = this.Filepath.PostedFile;
theFile.InputStream.Read(FileBinaryData, 0,FileLen);
NameValueCollection theCollection = new NameValueCollection();
theCollection.Add("ID", "someid"); -- these values will all be suppiled.
theCollection.Add("PWORD","somepwd");
theCollection.Add("PID", "sometextvalue");
theCollection.Add("FOLDER", "sometextvalue");
theCollection.Add("FILE001", theFile); --this needs to be the binary value
theCollection.Add("TYPE1","sometextvalue");
theCollection.Add("FILE002", "");
theCollection.Add("TYPE2","");
theCollection.Add("INVOICE_NUM", "");
theCollection.Add("TOTAL_FEE","");
string url = ConfigurationSettings.AppSettings["PostingURL"].ToString();
WebClient theRequest = new WebClient();
System.Net.NetworkCredential thecred = new NetworkCredential(ConfigurationSettings.AppSettings["NTLogin"].ToString(), ConfigurationSettings.AppSettings["NTPassword"].ToString(), ConfigurationSettings.AppSettings["Domain"].ToString());
theRequest.Credentials = thecred;
byte[] responseArray = theRequest.UploadValues(url,"POST",theCollection);
string m_ResultText = Encoding.ASCII.GetString(responseArray);
return m_ResultText;
I have also tried this code since then as well, which I actually found on this site, but still no success:
public string PostFile()
{
CookieContainer cookies = new CookieContainer();
//add or use cookies
NameValueCollection theCollection = new NameValueCollection();
theCollection["ID"]= ConfigurationSettings.AppSettings["Login"];
theCollection["PASSWORD"]= ConfigurationSettings.AppSettings["Password"];
theCollection["PID"]="IMB";
theCollection["FLD"]="FF-060727-0047-1";
theCollection["TYPE"]="APSL";
theCollection["FILE2"]=string.Empty;
theCollection["TYPE2"]=string.Empty;
theCollection["INV_NUM"]=string.Empty;
theCollection["TOT_FEE"]=string.Empty;
string uploadfile;// set to file to upload
uploadfile = @"c:\\AppraisalPort\\MockProduct.pdf";
string outdata = UploadFileEx(uploadfile,"File001","application/pdf",theCollection,cookies);
return outdata;
}
public static string UploadFileEx( string uploadfile, string fileFormName,string contenttype,NameValueCollection theCollection, CookieContainer cookies)
{
string url = ConfigurationSettings.AppSettings["ProductPostingURL"];
if( (fileFormName== null) ||(fileFormName.Length ==0))
{
fileFormName = "file";
}
if( (contenttype== null) || (contenttype.Length ==0))
{
contenttype = "application/octet-stream";
}
string postdata;
postdata = "?";
if (theCollection!=null)
{
foreach(string key in theCollection.Keys)
{
postdata+= key +"=" + theCollection.Get(key)+"&";
}
}
Uri uri = new Uri(url+postdata);
string boundary = "----------" + DateTime.Now.Ticks.ToString("x");
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(uri);
webrequest.CookieContainer = cookies;
webrequest.ContentType = "multipart/form-data; boundary=" + boundary;
webrequest.Method = "POST";
NetworkCredential thecred = new NetworkCredential(ConfigurationSettings.AppSettings["NTLogin"],ConfigurationSettings.AppSettings["NTPassword"], ConfigurationSettings.AppSettings["Domain"].ToString());
webrequest.Credentials = thecred;
StringBuilder sb = new StringBuilder();
sb.Append("--");
sb.Append(boundary);
sb.Append("\r\n");
sb.Append("Content-Disposition: form-data; name=\"");
sb.Append(fileFormName);
sb.Append("\"; filename=\"");
sb.Append(Path.GetFileName(uploadfile));
sb.Append("\"");
sb.Append("\r\n");
sb.Append("Content-Type: ");
sb.Append(contenttype);
sb.Append("\r\n");
sb.Append("\r\n");
string postHeader = sb.ToString();
byte[] postHeaderBytes = Encoding.UTF8.GetBytes(postHeader);
byte[] boundaryBytes = Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
FileStream fileStream = new FileStream(uploadfile,
FileMode.Open, FileAccess.Read);
long length = postHeaderBytes.Length + fileStream.Length +
boundaryBytes.Length;
webrequest.ContentLength = length;
Stream requestStream = webrequest.GetRequestStream();
requestStream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
byte[] buffer = new Byte[checked((uint)Math.Min(4096, (int) fileStream.Length))];
int bytesRead = 0;
while ( (bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0 )
requestStream.Write(buffer, 0, bytesRead);
requestStream.Write(boundaryBytes, 0, boundaryBytes.Length);
WebResponse responce = webrequest.GetResponse();
Stream s = responce.GetResponseStream();
StreamReader sr = new StreamReader(s);
return sr.ReadToEnd();
}
GG
|
|
|
|
|
Green Goblin wrote: I have also tried this code since then as well, which I actually found on this site, but still no success
What do you mean by "no success"? Symptoms? Error messages?
---
b { font-weight: normal; }
|
|
|
|
|
I'm building an app that automates outlook, and I'd like it to dynamically create signitures (based on the mail recipient and the current news feeds that are around at the time).
Any ideas?
|
|
|
|
|
i want to make WinApp that will help user to write name & job
and send this to MS word File as parameter and Print it ...
ex:
see this MSWord file http://www.shoppinp.com/ADSL123.doc[^]
i want to send fname , M , lname , job as parameter this parameter will go to [Parameter1] ,[Parameter2] ,[Parameter3] ,[Parameter4]
and then print this MS Word file
............................
Palestine
|
|
|
|
|
Just use COM interop to communicate with Word.
Add a reference to the Word object library and you can use the classes contained there.
Then you can perform a search&replace, fill in text marks, whatever you like...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
how can do this ???
Palestine
|
|
|
|
|
Hopefully, my last battle with Generics.
i have a class like so
<br />
public class ForumList<T> : IEnumerable {<br />
<br />
public void CreateMe()<br />
{<br />
T myclass = new T();<br />
}<br />
<br />
Is it possible to create an instance of the class or do I need to go through Reflection to do that?
Thankis,
Nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
You would do it like this:
public class ForumList<T> : IEnumerable where T : class, new()<br />
{<br />
public void CreateMe()<br />
{<br />
T myclass = new T();<br />
}<br />
}
I hope this helps.
Deus caritas est
|
|
|
|
|
Okay so am I doing this wrong then.
Because my ForumList Class should be a collection of Forum objects ( could be other objects too, not just Forum )
List<T>
but I need to create new items of type "T"
and I also want to extend the List class to provide some custom operations.
How should the class declaration look?
Is that something like
public class ForumList : List<T> where T : class, new()
{
}
-- modified at 12:34 Wednesday 16th August, 2006
-- modified at 12:36 Wednesday 16th August, 2006
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
These should (at least be close to) be working:
If you want to inherit List<>:
public class ForumList<T> : List<T> where T : class, new() {
public ForumList() {}
public T AddNewItem() {
T item = new T();
this.Add(item);
return item;
}
}
If you want to keep the list private in the class:
public class FourmList<T> : IEnumerable<T> where T : class, new() {
private List<T> list;
public ForumList() {
this.list = new List<T>();
}
public T AddNewItem() {
T item = new T();
this.list.Add(item);
return item;
}
public IEnumerator<T> GetEnumerator() {
return (IEnumerator<T>)this.list.GetEnumerator();
}
}
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa.
So one last question.
does the "new()" take care of all constructors(overloaded parameters) or do I list out each possible one
like
new(int) I.e.. new(int id)
?
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
The "new()" constraint only specifies that the class have to have a parameterless constructor. You can't specify any constraint for overloaded constructors.
---
b { font-weight: normal; }
|
|
|
|
|
Nope, your T must have a parameterless constructor
|
|
|
|
|
public class ForumList<t> : IEnumerable where T : new()
{
public void CreateMe()
{
T myclass = new T();
}
|
|
|
|
|
I just wanted to ask whether there's a way to access a shared memory buffer, (between two apps), in c# with managed code
Background on what i wanna do!
I want to make an application which consists of a client and a server, the server listens for new data on the buffer, and the client sends data to the buffer,
Any help will be much obliged (Note: i don't want to use TCP/IP the server and client are on the same PC)
|
|
|
|
|
Look into the IPC[^] (inter-process communication) channel. This is designed for cross-process communication on the same machine.
|
|
|
|
|
You can use MS Messaging Queue
You can use it locally or over a network.
Another old-fashoined way is using a DDE Server(which is not recommended to be used over a network beacuase of security issues.)
|
|
|
|
|
hi friends,this is naidu.
I developed one small windows service project.In that i used notifyicon control for system displaying in system tray, when i install windows service in my system. But i did not get any notify icon when installed my windows service. Bur I got that with windows form applications.But is gives a problem with windows service.
Please help me my friends....
regards,
naidu.
|
|
|
|
|
Greetings,
Windows service is not meant for user interaction. If you still like to achieve this functionality i suggest creating a Forms Application, then adding windows service controller to control your windows service, and adding notify icon control to that app.
|
|
|
|
|
Use the following link as sample to create tray application .net.
http://www.windowsforms.net/articles/notifyiconapplications.aspx
ram
|
|
|
|