|
|
Has anyone had any experience outputting an EMC in ANSI 837-4010 Format? I'm not new to C# but I have never had to output an ANSI formatted document before? Any help would be great.
Thanks,
Scott
|
|
|
|
|
Hi all,
Is there any libraries here i can use to convert midi to wave?
Appreciate any advice.
|
|
|
|
|
I'm having trouble with the following bit of code which generates an error at runtime. (it compiles fine) I've been working with C# for a total of about 3 hrs now, so go easy.
Main Program:
namespace StealthLog<br />
{<br />
static class Program<br />
{<br />
[STAThread]<br />
static void Main()<br />
{<br />
string str = "test of write";<br />
<br />
StreamWriter sw = StealthLog.LogMgr.NewLogFile();<br />
StealthLog.LogMgr.LogToFile(sw, str);<br />
<br />
Application.EnableVisualStyles();<br />
Application.SetCompatibleTextRenderingDefault(false);<br />
Application.Run(new Form1());<br />
}<br />
<br />
<br />
}<br />
}
LogManager Code:
namespace StealthLog<br />
{<br />
class LogMgr<br />
{<br />
internal static void LogToFile(StreamWriter sw, string text)<br />
{<br />
sw.WriteLine(text);<br />
}<br />
<br />
internal static StreamWriter NewLogFile()<br />
{<br />
string headerString = DateTime.Now.ToString() + "---------------\n";<br />
string fullFilePath = Settings.Default.LogDirectory.ToString() +<br />
Settings.Default.LogFile.ToString();<br />
<br />
if (File.Exists(fullFilePath))<br />
{<br />
using (StreamWriter sw = File.CreateText(fullFilePath))<br />
{<br />
sw.WriteLine("test1");<br />
return sw;<br />
}<br />
} else {<br />
using (StreamWriter sw = File.CreateText(fullFilePath))<br />
{<br />
sw.WriteLine("test2");<br />
return sw;<br />
}<br />
}<br />
}<br />
}<br />
}
The problem is in the sw.WriteLine(text); in the LogToFile section.
|
|
|
|
|
midnitrcr wrote: using (StreamWriter sw = File.CreateText(fullFilePath))
This is your problem. Your overall class design is wrong, you should have the stream as a member and control it entirely within the class. Either way, a using block means the object is disposed of at the end of the block, so you're returning a stream, which you've also disposed of.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
That makes sense now, thanks Christian!
|
|
|
|
|
I have a listview that I am using and I want to hide the horizontal scroll bar (at all times) but not the vertical one (should run in auto mode). How do I do this? The data can only be displayed in the details view.
|
|
|
|
|
I found the answer so that it will hide the scroll bar properly if the data fits in the list view. It will still appear when the data is wider than the control but at least now it looks better.
this.lstGenerate.Columns[0].Width = -1;
|
|
|
|
|
Hi guys,
please help!, I have a treeview with a context menu linked to the treeview nodes. I am trying to assigning shortcuts to the context menu items and they don't seem to work. Any ideas, suggestions?
Thank you
sasa
|
|
|
|
|
Hello everybody.
I'm actually working on a service for phone call notification... However, to achieve that I downloaded a library called CapiThread (this is a sort of wrapper for the capi2032.dll). This is an "old" Win32 dll that exports 5 methods. (InitCapiThread, CloseCapiThread, RegisterNotifyMessage, SetRequest, GetIndication).
To use that dll within a C# Windows-Service project i've written a COM wrapper (COM Object ISDNCapi). The ISDNCapi object retrieves the notifications thrown by the CapiThread dll if an indication is pending and fires an event (OnCapiIndication). There are some other classes to hold the data of the indications and requests.
i know that i can youse P/invoke. but i've choosen to build a com wrapper, because i want to have a more general solution. so i can use it with other languages... and i found the event handlers better than hooking on notify messages (in C#) the CapiThread.dll sends.
Okay...
Now i've build a metadata-dll with TLBIMP that i use in my program. (As descripted in "COM Interoperability in .NET Framework: Part I"). The code compiles without any problems, but during the instantiation of my class ISDNCapi the following error raises:
Retrieving the COM class factory for component with CLSID {3A5119AE-E5CC-406F-8F62-FFC340C424CE} failed due to the following error: 80040154.
The component is definetly registered and can access it's dependecies, because instantiation it in VB6 causes no error and the regsvr32 succeeds also.
Somebody suggested me to check if the class factory registers correctly... but i've never done this seperately (in vc 6) so i don't know howto register it nor what to look for...
i've created the project with the option "component registrar". do i have to call the RegisterAll function of the Registrar class?
can anybody please check it in my code?
I've uploaded the sources of my projects to my server:
CapiWrapperSln
ISDNMonServer
And here are the complete exception details:
System.Runtime.InteropServices.COMException was unhandled
Message="Retrieving the COM class factory for component with CLSID {3A5119AE-E5CC-406F-8F62-FFC340C424CE} failed due to the following error: 80040154."
Source="ISDNMonServer"
ErrorCode=-2147221164
StackTrace:
at ISDNMonServer.ISDNMonServer..ctor() in E:\Entwicklungsumgebung\Projekte\Office\ISDNMon\ISDNMonServer\ISDNMonServer.cs:line 20
at ISDNMonServer.Program.Main() in E:\Entwicklungsumgebung\Projekte\Office\ISDNMon\ISDNMonServer\Program.cs:line 22
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
thanks.
Martin.
|
|
|
|
|
Hi guys,
I need some help please, I have a listbox with certain data that I am processing and adding every selected item processed into an array. Here is my code.
StringCollection scolBrn=null;
scolBrn= new StringCollection();
string[] arrTemp=null;
while(lbSelBranches.SelectedItems.Count!=0 || lbSelBranches.Items.Count!=0)
{
lbSelBranches.SelectedIndex=0;
char sep1='*';
arrTemp=lbSelBranches.SelectedItem.ToString().Split(sep1);
scolBrn.Add(arrTemp[arrTemp.GetLowerBound(0)]);
lbSelBranches.Items.Remove(lbSelBranches.SelectedItem);
}
What I am trying to do is for every selected item get the lower bound and add it to the string collection and than go through the next selected item and add it again to the string collection, i.e. if the first selected item is 010 blah blah and the second item in list is 020 blah blah than the string collection at the end of processing should have 010020.
Please help guys
sasa
|
|
|
|
|
Then you should not change the SelectedIndex property. That changes which items are selected, so you will lose the selection.
Loop through the items in the SelectedItems collection:
foreach (string item in lbSelBranches.SelectedItems) {
scolBrn.Add(item.Split('*')[0]);
}
---
b { font-weight: normal; }
|
|
|
|
|
How can I see what drive letters are being used by the system so i can return a list to the user that shows what drive letters are not being used?
|
|
|
|
|
System.IO.Directory.GetLogicalDrives()
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Sorry for the long post but I've been stuck on this for a while now and I'm hoping anyone can help.
I'm trying to make an ASP.NET usercontrol that renders 'buttons' (linkbuttons within table cells) that, when clicked, fire delegates. After having some initial problems with serialisation to ViewState, I have managed to make it respond to the click and fire the delegate, without issue.
The usercontrol has a private Hashtable that stores the buttons to render, which is persisted through ViewState, and a private IsDirty boolean that is set to false on initialisation and true if any changes are made to a button or the Hashtable. I expose the following methods to the rest of the app:
- RegisterButton(...) -> This adds to the Hashtable
- IsButtonRegistered(...) -> This queries the Hashtable
A button is a LinkButton that is dynamically generated, with a standard click event. The click event code retrieves the delegate and executes it.
As a test, I have a page with a usercontrol. This usercontrol registers a button on Load. The delegate for that button is also within this usercontrol. The delegate's job is to create another button if it is not already create. As such, the usercontrol's code is as follows:
<br />
private void TestUC2_Load(object sender, EventArgs e)<br />
{<br />
DelegateButtons db = (this.Page as Default).DelegateButtons1;<br />
if (db != null && !db.IsButtonRegistered("foo"))<br />
db.RegisterButton("foo", "Foo", "dbutton", new ButtonAction(this.TestAction));<br />
}<br />
<br />
private void TestAction()<br />
{<br />
DelegateButtons db = (this.Page as Default).DelegateButtons1;<br />
if (db != null && !db.IsButtonRegistered("bar"))<br />
db.RegisterButton("bar", "Bar", "dbutton", new ButtonAction(this.TestAction));<br />
}<br />
If I step into this code, I can see that the 'foo' button is created as it should be. If I click the button, the TestAction method is called as it should be, but while inside the TestAction method, the 'bar' button is already registered. As such:
Hashtable
1. Page loads for the first time {}
2. TestUC registers a 'foo' button {foo}
3. Page is drawn {foo}
4. ViewState is saved {foo}
5. User clicks 'foo' button {foo}
6. Page loads {}
7. ViewState is loaded {foo}
8. Button click event is called {foo}
9. TestAction is called {foo}
10. TestAction checks if 'bar' exists {foo,bar}
11. TestAction says 'bar' exists so doesn't recreate it {foo,bar}
12. TestAction finishes, step returns to click event {foo}
I'm really stuck as to why this could be -- can anyone help?
Regards,
J.
|
|
|
|
|
When i run my application on account diffrent than admin application generate this error:
Unable to open shim database version registry key - v2.0.50727.00000
and closing.
Any idea how can i fix it?
Greetings
|
|
|
|
|
|
I'm using the System.Net.Mail client.Send(MailMessage) (Visual Studio 2005) method to send an email confirmation that a new contact has been added to an email distribution list. Before adding the contact to the relevant distribution list database, I want to confirm that the contact's email address is a valid one, so that if, say, the user made a typo when entering the email address, he can know.
By using error catching, I can catch and report formatting errors in the email address, but if the format is correct but the address itself is not a valid one, no error is caught. Is there a way to check for successful delivery of an email shortly (almost immediately) after sending it? Thanks.
|
|
|
|
|
Won't the it throw an exception if it can't resolve the address of the email server. I.e. hjakfhjksd';# is not a valid email so that's caught by your validation. But support@microsoft.com is but may not exist. Surely there's a timeout of some sort if there's no response from the server.
Note, just my thoughts, havn't tried it yet.
As of how to accomplish that have you ever tried Google?
Failing that try .
|
|
|
|
|
No, there isn't. The only way to be sure that a mail has reached the recipient is to make the mail program send a read confirmation. Otherwise you can never be sure where the mail went. It can be filtered as spam by the sending server, by the recieving server or by the recipients mail program, or it can be held in a queue for hours or days before the server concludes that it can't be sent. There is no way to get an immediate confirmation, though.
If there was, that would be the dream for spammers. They could create email addresses by random, and get an immediate response whether the email address existed or not.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
i have an application with a menu, and each time i click on the menu a different userControle is loaded in the main view. Some of those user controls takes time to load and the display is quite ugly when loading. So i thought i could display a specific user control with something like "please wait loading" while the real user control is loading in background, and when its done display the real one.
I searched all over google but couldn't find what i need, so i ask here if someone know how to do that
Thanks
|
|
|
|
|
if you wanted to just display "please wait loading", you could consider having a function that you call when beginning to load the control to display the message, and another to close it when done.
i would not bother making the app multithreaded for something this simple, as it could be more hassle, unless you still want the user to interact while the control is loading. (Though this is only my opinion.)
|
|
|
|
|
Why not preload all of the controls at startup (using s splash screen while this happens), then just enable and bring to front (change the z-order) the one you want to activate (disable the one being replaced). Changing the z-order will be much faster, and you get the loading out of the way at startup.
|
|
|
|
|
What is your application, Web or Windows?
Use something like
UserControl.visible = false;
Label.visible = true;
The reverse when user control is ready
only two letters away from being an asset
|
|
|
|
|
How to READ/WRITE to/from Microsoft Access database
Thanks
Vasildb
|
|
|
|