|
|
Rizwan Rathore wrote: plzzz reply in detail
please post in detail...
Rizwan Rathore wrote: a project developed in VC++
What sort of project in VC++?
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
well i m developing a text mining engine in C# and i ve found a utility developed in VC++ that creates the inverted index from the given dataset so i want to use this code in my prgram the project is not developed in VC dot net its developed in VS
Regards,
|
|
|
|
|
Rizwan Rathore wrote: i ve found a utility developed in VC++
Rizwan Rathore wrote: so i want to use this code in my prgram
So you have the source code? a library? an application? You are still not being specific.
Rizwan Rathore wrote: is not developed in VC dot net its developed in VS
Visual C++ .NET is in Visual Studio. If "VS" does not mean "Visual Studio" I don't know what it means. You really need to be more specific.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hi Sir, I have sent u the project via email at ur email address
Regards,
|
|
|
|
|
Can we run C# DotNet Exe file on a system where Dot Net is not installed?? if yes then how wat files we need to embed...
and if No then is there anyother solution for that
Looking forward for help
Regards,
|
|
|
|
|
You can't.
THere's at least one, for pay program that will staticly link your executable and the framework, but there's nothing free to do so.
|
|
|
|
|
|
|
Wow! All I saw was a high value scrabble score.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi,
i created a class "Rect" that contains information about a Recatngle (Point X, Point Y, Pen pen, Brush brush....).
and when i tried to serialize an object of this class to binary file i got an Exception that this object couldn't be serialized!
-------
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: The type System.Drawing.Pen in Assembly System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not marked as serializable.
--------
how could this object be serialzed?
also i got the same problem with System.Drawing.Brush!
thanx in advance!!
Khaleek Coool
|
|
|
|
|
Why do you want to serialize these classes? Why not just save the pertinent information such as color, pen with, etc. in your class data. When you deserialize the class, re-create the Pen, Brush, etc. from this information.
Deus caritas est
|
|
|
|
|
thanx but i have many other objects to be saved in binary file, one of these objects is rectangle for example which contains Pen and Brush objects, so when i tried to save the rectangle the exception above came up.
but how to do this? to save only the properties i need in binary without serialize the object?
any sample code please?
|
|
|
|
|
Normally you could just apply the Serializable attribute to your class:
[Serializable]
public class MyClass { ... }
Brush and its deriving classes aren't marked serializable so you have to save their properties manually (as Andy already suggested).
|
|
|
|
|
How do I connect to a remote Access database?
I typically connect to an NT server using TerminalServices and entering an IP address.
Once connected I login in using a user ID and password, then navigate to the Access DB.
I want to view the database instead, using a C# program.
(we don't have MS Access installed at the remote location, therefore I can't open it to view)
Given the connection string provided for Access databases:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"
Where would you place the IP address? Do you also need a port#?
jwittwe
|
|
|
|
|
I tryed to do it with a local program to server-database, doesn't work... not now and I guess not ever...
the only way to do this is to put a webservice on the server...
check your books or some articles about that.
|
|
|
|
|
I am calling a form that prompts for some values and then displays a directory browser dialog box. When I exit back to my calling form to continue processing, a partial image of the dialog box remains on the screen until processing has completed. Is there a way to re-paint the calling form to clean up the display while processing proceeds?
|
|
|
|
|
When you return to the calling form from the directory browser dialog, do the following before executing the processing code:
this.Invalidate();
this.Update();
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
My intent is to construct a very simple splash screen that can be used both at project start as well as a status screen for long-running tasks. Here is the guts of the code (SplashScreen is private so that it can only be accessed via the Load class)
public delegate void SetTextDelegate(string message, string action);
partial class SplashScreen : Form
{
#region Private variables and Properties
string actionText = string.Empty;
string messageData = string.Empty;
int messageLength;
bool loaded;
public bool ScreenLoaded { get { return loaded; } }
#endregion
#region .ctor logic
public SplashScreen(string message, string action, string title)
{
InitializeComponent();
messageData = message;
actionText = action;
this.title.Text = title;
SetText();
}
#endregion
#region Form Thread methods
private void SetText()
{
if (InvokeRequired)
Invoke(new MethodInvoker(SetText));
this.messageText.Text = String.Concat(messageData, " : ", actionText);
this.messageLength = this.messageText.Text.Length;
if (loaded)
this.Invalidate();
}
private void ExpandText()
{
if (InvokeRequired)
Invoke(new MethodInvoker(ExpandText));
this.messageText.Text += ".";
this.Invalidate();
}
private void InvokeSetText(string message, string action)
{
messageData = message;
actionText = action;
SetText();
}
protected override void OnLoad(EventArgs e)
{
this.Activate();
base.OnLoad(e);
}
private void threadTimer_Tick(object sender, EventArgs e)
{
System.Diagnostics.Trace.WriteLine("Thread timer has ticked.");
if (this.messageText.Text.Length > messageLength + 4)
{
SetText();
}
else
{
ExpandText();
}
}
private void SplashScreen_Load(object sender, EventArgs e)
{
this.threadTimer.Enabled = true;
this.threadTimer.Interval = 100;
this.threadTimer.Start();
}
private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e)
{
this.threadTimer.Stop();
}
private void SplashScreen_Shown(object sender, EventArgs e)
{
this.loaded = true;
}
#endregion
#region External Thread methods
public void SetMessageData(string message, string action)
{
if (InvokeRequired)
{
SetTextDelegate invoker = new SetTextDelegate(InvokeSetText);
Invoke(invoker, new object[] { message, action });
}
else
{ }
}
#endregion
}
public static class Loader
{
#region Static methods and data
static SplashScreen screen;
static Thread SplashThread;
static public void ShowSplashScreen(string message, string action, string title)
{
if (SplashThread != null)
return;
screen = new SplashScreen(message, action, title);
SplashThread = new Thread(new ThreadStart(ShowScreen));
SplashThread.IsBackground = true;
SplashThread.SetApartmentState(ApartmentState.STA);
SplashThread.Start();
while (screen.ScreenLoaded == false && SplashThread.ThreadState == ThreadState.Running)
{ }
}
[STAThread]
static void ShowScreen()
{
if (screen != null)
{
Application.Run(screen);
}
}
public static void UpdateScreen(string message, string action)
{
screen.SetMessageData(message, action);
}
public static void TerminateScreen()
{
if (screen == null) return;
if (SplashThread == null) return;
screen.Invoke(new MethodInvoker(screen.Close));
screen = null;
SplashThread = null;
}
I have a testbed application with one button that does a synchronous search and a second one that does a mutli-threaded search. Both use the splashscreen to display steps being performed. My intent for the splashscreen is that a timer ticks every 100 ms and adds a '.' to the end of the message until there are five '.' and then it starts all over again.
Problem: In the synchronous search the timer does not seem to ever get started even though it should be on a totally separate thread and started when the form loads.
Problem: In asynchronous search mode the timer does start, but I get a CrossThreadException the first time I go to add a '.' !!
Does anyone have a suggestion as to where I messed up in my code????
-- modified at 13:11 Thursday 11th May, 2006
|
|
|
|
|
You cannot access a control on a thread other than the one that created it. This has been true for decades now.
Search this site for more info; there's a ton of articles on the topic of how to update a control from a different thread.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Islamic Domination: Coming to a Jewish state near you!
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Obviously you never looked at the code. The splashscreen is started on its' own thread, the owning thread access is controlled via IsInvokable, and the timer is always on the message pump thread unless it is started by the parent thread. I was very careful to ensure that the parent thread never issued a timer.Start()...which is also why the static logic was broken out as a separate class object.
|
|
|
|
|
One glaring thing I'm seeing is that when you do
if (InvokeRequired)
Invoke ( ...);
...
you aren't exiting the function, so you're still trying to continue on the wrong thread PLUS trying to invoke the function.
if (InvokeRequired)
{
Invoke ( ...);
return;
}
...
would correct that particular issue.
--
I've killed again, haven't I?
|
|
|
|
|
Thanks alot. I never saw that!
|
|
|
|
|
Hello everyone.
How do I dynamically (by code and not by adding reference to the project) load class created inside a class-library solution, to my code?
DllImport attribute can load function only as I can tell...
Thanks
|
|
|
|
|
It would depend alot on whether or not it is a COM or .NET dll that you wish to load. If it is a .NET dll you can use reflection to load the assembly that the class lives within. I believe it is in Assembly.Load() that you want to research.
|
|
|
|