|
|
Hi Programmers,
I am rewriting some of my COM Server (Out proc) executable to .Net enviornment.
I havn't found any clue for same, I have googled for same, but everytime I encountered IN_PROC DLL only. might i am searching from wrong keyword.
Actually I needed executable, who expose it's class or interface to dot net application and work accordingly. I have found workaround using IPC DotNet Remoting. i.e. creating class library as proxy and subscribing event in both Client and outproc exe, but it is not full proof.
So please help me if you know something in this reqards
Thanks
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
Can please anyone tell me that How to get the IP Address of the network printer through the codeing in .NET using C#.
Thanks
|
|
|
|
|
Use WMI to read all your printer properties. For a sample, see here,
|
|
|
|
|
Hello my friends. I am going to do a senior project and we found that Mobile banking is going to be a good project. Is it possible to do it in C# with less than 4 months? Or if you have any idea about this or if you worked on it, please help me out. Thank you
|
|
|
|
|
|
Hi all,
is there any way that we can bind Textboxes to a member varaible data for display , like we do in MFC ?
if so pls advice.
|
|
|
|
|
Public form properties and DataBindings ...
public partial class Form1 : Form {
public string TheMember { get; set; }
private TextBox _textBox;
public Form1() {
InitializeComponent();
TheMember = "Hello";
_textBox = new TextBox();
_textBox.DataBindings.Add( "Text", this, "TheMember" );
this.Controls.Add( _textBox );
}
}
|
|
|
|
|
Thanks Gerry Schmitz for your time.
|
|
|
|
|
There is an image capturing device which outputs images in wmf. This image is directly stored in the db. These images are supposed to appear on web page (in IE). Only some of the images appear; others don't. When we investigated the problem we observed various things:
a) Those problematic images don't appear visible on the web page, but they are still there! If you right click the image and try to save it on your hard disk from IE browser, you get a file.
b) This file is viewable via desktop image viewers like Microsoft Picture Viewer.
c) We can view this image if we convert the file into jpeg.
The jpeg alternative seem viable, but its simply too much processing on the web server if we adpoted that approach. Its only that some of these images have this problem. We have millions of records of data with images. We figure only 10 % of images do have the issue.
Is there a way to detect such problematic wmf files?
|
|
|
|
|
When i wanna to see the "Datatable visualizer" I get Error of :
unable to cast object of type 'Custom Exception DataHolder' ...
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidCastException: Unable to cast object of type 'CustomExceptionDataHolder' to type 'CustomExceptionDataHolder'.
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.MaybeDeserializeAndThrowException(Byte[] data)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.CreateViewer(IntPtr hwnd, HostServicesHelper hsh, SafeProxyWrapper proxy)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
Microsoft.VisualStudio.CommonIDE
Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.1
CodeBase: file:----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
Microsoft.VisualStudio.DebuggerVisualizers
Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.1
CodeBase: file:----------------------------------------
Microsoft.VisualStudio.DebuggerVisualizers
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.42
CodeBase: file:----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
I searched a lot in google but not get the ans!
So please Help!
|
|
|
|
|
In your project go to "References" and delete any reference which have any concerns with "Visualizers".
It will work, because updates have been done on your system with visualizers components, like microsoft updates, so deleting this reference which references to new type of datatables and datasets <Template> should do the job.
Let me know if i can help in any other way.
Hope it helps.
|
|
|
|
|
I am building a project. It will have a main menu/GUI from which many application/options will be "spawned."
What is a good way to build the main menu so as to allow someone to add an app without having to recompile the main menu?
Gene
==============================================
100 years from now, what do you want people to read on your tombstone?
I want them to read:
"Here lies a man of integrity whose reach always exceeded his grasp and who knew the difference between honor and duty.”
==============================================
|
|
|
|
|
|
If the "applications/options" are just separate EXE's, this is very easy. You keep an XML configuration file that dictates what the menu looks like and which EXE each option opens. You then dynamically build the menu based on the XML file. By loading the XML configuration into memory into a class, you can then keep track of which EXE to launch when a particular menu option is chosen.
If you want to be a little more flexible, you can have the XML file specify 1) the menu layout 2) the DLL to load 3) the method on the DLL to call. You may need other info, such as the class and the namespace. You will then use Reflection to dynamically load the DLL and call the method on the class indicated by the XML configuration. If you want to go that route, start here (this would be a plug-in system, as was suggested by the poster above).
You could also go a third route. You could have your main app be an EXE, then have a class in a different project that dictates the menu handling. It could return a menu object, as well as all the event handling (e.g., load a particular EXE when a menu item is clicked). Your main EXE would call that DLL to ask for the menu. You would then only have to change that DLL whenever you wanted to add items to the menu. That is a recompile, but only of part of the application.
|
|
|
|
|
Thank you and PIEBALDconsult. Very good ideas.
Good starting places.
Gene
==============================================
100 years from now, what do you want people to read on your tombstone?
I want them to read:
"Here lies a man of integrity whose reach always exceeded his grasp and who knew the difference between honor and duty.”
==============================================
|
|
|
|
|
If I have the following strings etc setup would I be able to use a placeholder?
I hope below makes sense, how would I let the placeholsers know what to reference?
string FirstName = txtFirstName.Text;
string MiddleName = txtMiddleName.Text;
string LastName = txtLastName.Text;
string idNumber = txtIdNumber.Text;
string eMailAddress = txtEmailAddress.Text;
string WebSite = txtWebsiteAddress.Text;
string HomePhone = txtHomePhone.Text;
string WorkPhone = txtWorkPhone.Text;
string FaxPhone = txtFaxPhone.Text;
string MobilePhone = txtMobilePhone.Text;
bool ContactVerified = chkVerified.Checked;
bool Tenant = chkTenant.Checked;
bool Owner = chkOwner.Checked;
SqlCommand myCommand = new SqlCommand("INSERT INTO contacts (first_name,middle_name,last_name,id_number,home_phone,work_phone,fax_phone,mobile_number,email_address,website_address,contact_verified,tenant,owner)" +
"Values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}')", myconnection);
|
|
|
|
|
Any time i've ever used place holders is with when creating a string using the StringBuilder class and its Append method. I tried doing it with normal strings once, but got an error and didnt feel like messing with it at the time. I hope you're validting the input in those text boxes on the server somehow before you put them into the query.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I strongly suggest you don't construct query strings like that; instead use SQLParameter to provide your parameter values. It is easier as it reduces the trouble you would have with special characters in string literals, and the trouble with datetime formatting; and it is much safer, as it protects you against SQL Injection attacks.
|
|
|
|
|
Cool thanks will look into this as I am still very new to C#.
Any recommended reading on this topic?
|
|
|
|
|
Yes[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi all,
I've been trying to become more familiar with classes and instantiating them and the different times one would need to do so. I came across the following tutorial (http://www.csharp-station.com/Tutorials/Lesson05.aspx[^]
and it has the code below. Albeit, this code doesn't do anything useful, but again, just raises a question. The question I have is what would drive instantiating the class versus declaring getChoice() as static? As I'm a ME, please use plain english.
using System;
class Address
{
public string name;
public string address;
}
class MethodParams
{
public static void Main()
{
string myChoice;
MethodParams mp = new MethodParams();
do
{
myChoice = mp.getChoice();
mp.makeDecision(myChoice);
Console.Write("press Enter key to continue...");
Console.ReadLine();
Console.WriteLine();
} while (myChoice != "Q" && myChoice != "q");
}
string getChoice()
{
string myChoice;
Console.WriteLine("My Address Book\n");
Console.WriteLine("A - Add New Address");
Console.WriteLine("D - Delete Address");
Console.WriteLine("M - Modify Address");
Console.WriteLine("V - View Addresses");
Console.WriteLine("Q - Quit\n");
Console.WriteLine("Choice (A,D,M,V,or Q): ");
myChoice = Console.ReadLine();
return myChoice;
}
void makeDecision(string myChoice)
{
Address addr = new Address();
switch(myChoice)
{
case "A":
case "a":
addr.name = "Joe";
addr.address = "C# Station";
this.addAddress(ref addr);
break;
case "D":
case "d":
addr.name = "Robert";
this.deleteAddress(addr.name);
break;
case "M":
case "m":
addr.name = "Matt";
this.modifyAddress(out addr);
Console.WriteLine("Name is now {0}.", addr.name);
break;
case "V":
case "v":
this.viewAddresses("Cheryl", "Joe", "Matt", "Robert");
break;
case "Q":
case "q":
Console.WriteLine("Bye.");
break;
default:
Console.WriteLine("{0} is not a valid choice", myChoice);
break;
}
}
void addAddress(ref Address addr)
{
Console.WriteLine("Name: {0}, Address: {1} added.", addr.name, addr.address);
}
void deleteAddress(string name)
{
Console.WriteLine("You wish to delete {0}'s address.", name);
}
void modifyAddress(out Address addr)
{
addr = new Address();
addr.name = "Joe";
addr.address = "C# Station";
}
void viewAddresses(params string[] names)
{
foreach (string name in names)
{
Console.WriteLine("Name: {0}", name);
}
}
}
|
|
|
|
|
In the case above there is almost no difference; the tutorial is trying to illustrate a point that we can separate the logic from static code into methods of a class. This is the basis of inheritance whereby we can build on a simple or base class and keep adding functionality to create quite sophisticated objects. If you really have trouble understanding this I would suggest doing some study on OOP and C# classes.
[edit]Sorry, I meant C# not C++.[/edit]
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: In the case above there is almost no difference; the tutorial is trying to illustrate a point that we can separate the logic from static code into methods of a class.
Yes, I understand that. I was hoping to get a general explanation of when one would want to declare the method as static versus instantiating the class. I would imagine that this has or could be the subject of a dissertation, but was looking for a brief answer as to what would be a reason for not declaring the method as static.
|
|
|
|
|
When a class represents a real-life object (e.g. a car), or something more abstract but not unique by its very nature (a binary tree), or something with some internal state, then it should be modeled by a non-static class.
It is only when there is going to be only one of them ever needed and it has no state, that you should consider a static class, and hence zero rather than one instances. A collection of global constants could be an example; a collection of simple methods could be too (see e.g. the trig functions in the Math class).
static classes are often abused; when in doubt, the class should not be static.
|
|
|
|
|