|
Add a ReadConfigDataFromFile method to the class in the dll?
|
|
|
|
|
hi Dan
I was trying to do so.. but the problem is i cant access this file from dll like this: Application.StartPath + "filename.config" (it doesn't work, because Application.StartPath references to c:\windows\system32 and not to the directory where my .dll file is placed)
thank you
|
|
|
|
|
Hmmm. store the dll path in the registry perhaps?
|
|
|
|
|
Guess it's a good idea!
I'll try to do it.
Thank you so much Dan
|
|
|
|
|
Hi all,
I am new to .NET PocketPC SDK.I have one major issue in PocketPC application.I want to save bitmap files in PocketPC and open the same in write mode.I am able to save the bitmap file and open it in read mode,but i am not able to open it in write mode.please reply.
Regards,
S.Sevugan.
|
|
|
|
|
Okay, I have had no luck and somehow I know this should be easy. I made an app that receives data and processes the info and does calculations, etc. But I can't get the data to write to anything on the form. I know how to use form button and such, but I want the app itself to write to a textbox, datagrid, whatever on the form. But I can't get it to work. Any help is greatly appreciated. I'm using Visual C# .Net. I can make it write to the console, but I want it on the end user's app form.
Thanks,
RABB17
|
|
|
|
|
What exactly is the problem you're facing? Text that you write to the textbox doesn't appear? Throws exceptions? Are you writing to the form controls from a different thread?
If you can show us the offending piece of code, it would be much easier.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have my Mainform which gets initialized upon start of the .exe file.
Once the user clicks Start the program receives info from other apps, hence no further user intervention happens. This info is then processed based on the what the other apps are doing, hence when a data app does something, the MainApp process that info and returns a calculation. This is done over and over as the data app returns new information, but never with any additional user intervention.
I can do a printout on a command prompt, but I want it to appear on the MainForm. It's always just a single line of text.
But whenever I reference the form within the MainApp, I get an exception error.
"Unhandled Exception: System.NullReferenceException: Object reference not set toan instance of an object." to be specific.
Hope that explains it better. Any help is greatly appreciated!
RABB17
|
|
|
|
|
How does MainApp get a reference to MainForm? From the error, the MainForm instance in MainApp is null. Make sure MainApp has a valid reference to MainForm before attempting to call methods on it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
First, I appreciate your helping on this.
The namespace in MainForm is IRead.
In MainApp, I have:
"using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using IRead;
using System.IO;
using System.Resources;
then following calculations I call
printDecision();
which looks like this:
public void printDecision()
{
mainform.MainForm_UpdateText();
}
*********************************************************
My MainForm looks like This:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.IO;
using System.Resources;
using IRead
namespace IRead
{
#region Public Delegates
// delegates used to call MainForm functions from worker thread
public delegate void DelegateAddString(String s);
public delegate void DelegateThreadFinished();
#endregion
///
/// Main form for WorkerThread Sample
///
public class MainForm : Form
{
.
.
.
public MainForm()
{
InitializeComponent();
MainForm_UpdateText();
}
And further on, inside class MainForm but outide public MainForm():
public void MainForm_UpdateText()
{
this.textBox11.Text = MyApp.finalDecisionString;
}
|
|
|
|
|
Rabbit17 wrote:
public void printDecision()
{
mainform.MainForm_UpdateText();
}
But where has mainform been assigned to an instance of MainForm? That's where your problem is, you need to somehow pass an instance of MainForm to MainApp, if you want to call methods/properties on MainForm. I'd suggest adding a property to MainApp, something like
class MainApp
{
public static Form MainForm
{
set { mainForm = value; }
}
}
class MainForm
{
...
public MainForm()
{
...
MainApp.MainForm = this;
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Okay, I did that... yeah sometimes the basics are so overlooked... now it doesn't update. But at least it compiles now! This is my code on the MainForm:
public void textBox11_TextChanged(object sender, System.EventArgs e)
{
}
public void MainForm_UpdateText()
{
textBox11.Text = MyApp.finalDecisionString;
}
and I call MainForm_UpdateText() from the MainApp with:
public void printDecision()
{
MainForm dummy;
dummy = new MainForm();
dummy.MainForm_UpdateText();
}
So I guess my question is if the textbox can only be changed by an object sender, how can I make sender something internal instead of a user click?
|
|
|
|
|
Rabbit17 wrote:
public void printDecision()
{
MainForm dummy;
dummy = new MainForm();
dummy.MainForm_UpdateText();
}
This is not going to work. You're creating a new instance of MainForm, so changing the textbox value in that form is not going to reflect in the original form. You need to have some property exposed by MyApp, that is set in the MainForm's constructor (see my previous post). You'll then call MainForm_UpdateText() on that instance, which will do what you want.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I'm fairly new so this is probably a dumb question.
My App generates various data in class files away from the form class that have nothing to do with any additional user input. Basically, they start the app and it makes calculations.
My question is, how do I get the output to display somewhere on the form. I tried using textboxes, but that was a bust because I couldn't reference them without it bombing out. Apparently they are mainly for users inputting text, not seeing displayed text.
Thanks,
RABB17
|
|
|
|
|
Don't reference the form, or textbox, in the class; reference the class in the form.
Form1_CalculateButtonClick()
{
MyClass cls = new MyClass();
Textbox1.Text = cls.DoCalculation();
}
|
|
|
|
|
I tried your code above but it didn't help. It does makes sense, but once my app is started it is constantly running and gathering data from other apps and therefore it only initializes the Mainform once.
If I do try to reference the form I get this error:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
Any further ideas? Thanks!
RABB17
|
|
|
|
|
All you have to do is set the Text property to whatever string you need to display the results.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have created a basic setup project to install several files. One of the files is a batch file that makes a RASDIAL call to a specific Dial Up Connection in Network Connections. If possible I would like to automate the creation the Dial Up connection if it does not exist during the setup process.
Is this possible ? Is there a way for creating a template or file that can just be placed in a specific location that will be viewed by the system as the dial up connection ?
-> Installatoi Intended for a WinXP system
-> Using the .NET Enviroment
Thanks
Clint
|
|
|
|
|
how to send files(eg powerpoint slides) from server to client
|
|
|
|
|
I am having some very strange problems with ArrayList in a class I've written. When I create and populate an ArrayList, only the odd indexes are populated, and the evens are no where to be found. When I try to iterate through the list, it fails on the first index with an "Object not set to an instance" error (since index 0 is technically even). If I start on index 1, it succeeds, but fails when it gets to index 2.
When I watch the ArrayList in VS.NET's debugger, I get a list like this:
list - {Count(5)}
[1] - object 0
[3] - object 1
[5] - object 2
[7] - object 3
[9] - object 4
When it should be this:
list - {Count(5)}
[0] - object 0
[1] - object 1
[2] - object 2
[3] - object 3
[4] - object 4
Has anyone ever encountered something like this before? Any ideas what could possibly be causing such odd behavior with the ArrayList object? Thanks for any help.
|
|
|
|
|
Without seeing your source I can't say for certain, but at a guess you're incrementing the index you add at both before and after you insert an element into the array.
|
|
|
|
|
How are you populating the ArrayList? Using the constructor that takes an ICollection as parameter?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
ArrayList list = new ArrayList();
foreach (obj in objectarray)
{
list.Add(obj);
}
return list;
Thats basically it. I'm not doing anything special, or out of the ordinary. I'm just using the arraylist at its most basic level.
|
|
|
|
|
Very strange. What exception do you get when you try to access index 0?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
From the c# programmer's reference:
The foreach statement repeats a group of embedded statements for each
element in an array or an object collection. The foreach statement is used to
iterate through the collection to get the desired information, but should not
be used to change the contents of the collection to avoid unpredictable side
effects. The statement takes the following form.....
If you change the collection, the iterator is no longer valid.
[the first time I posted this, I accidentally replied to S. Senthil Kumar. sorry for the mistake]
[P.S. I actually did reply to Jon Rista this time, but it still shows as a reply to S. Senthil Kumar. I don't know what I can do.]
|
|
|
|