|
Thank You Mike Dimmick and cadi! You made it for me, and my week is saved.
I'll bring up a skoal to you tomorrow evening.
_____________________________
...and justice for all
APe
|
|
|
|
|
I am working on a database application that I call MultiBase. The jist of the application is that it will load a database and create a GUI to interact with it. The application also impliments search and reporting capabilities. The application is currently a winform application, but I plan on implimenting a web interface at a later date.
Currently when I select the database to use my application looks for an associated XML file that defines the controls, associated database fields, etc, to be used to create the GUI. The XML looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<MultiBase xmlns="http://tempuri.org/MultiBase.xsd">
<control>
<controlType>ComboBox</controlType>
<displayText>Manufacture</displayText>
<databaseField>Manufacture</databaseField>
<databaseLookUp>Manufactures</databaseLookUp>
<displayGroup>1</displayGroup>
<displaySubGroup>1</displaySubGroup>
<tabIndex>1</tabIndex>
<toolTip>Select/Enter a manufacturer</toolTip>
</control>
<control>
<controlType>TextBox</controlType>
<displayText>Part Number</displayText>
<databaseField>Part_Number</databaseField>
<databaseLookUp></databaseLookUp>
<displayGroup>1</displayGroup>
<displaySubGroup>2</displaySubGroup>
<tabIndex>2</tabIndex>
<toolTip>Enter part number</toolTip>
</control>
</MultiBase>
In addition to storing the controls to be used in the GUI I want to store the reports that the user has created. The XML would look something like this:
<report>
<reportName>All Records</reportName>
<selectCommand>select * from main</selectCommand>
</report>
Would it be possible (or correct) to store both the controls and the reports in the same XML file (and how do I do that) or use a seperate file for the controls and reports (which would be easy)? I was trying to keep the extra files to a minimum. I would like to have one XML file store both the controls and reports, but I'm unsure as to how to setup the layout and then use the the XmlDocument object to iterate through it (and still keep a well formed document). There is no relation between the controls and reports.
Any thoughts?
Thanks.
Any thoughts?
www.lovethosetrains.com
|
|
|
|
|
You can try some thing like this...
<?xml version="1.0" encoding="utf-8" ?>
<MultiBase xmlns="http://tempuri.org/MultiBase.xsd">
<controls>
<control>
<controlType>ComboBox</controlType>
<displayText>Manufacture</displayText>
<databaseField>Manufacture</databaseField>
<databaseLookUp>Manufactures</databaseLookUp>
<displayGroup>1</displayGroup>
<displaySubGroup>1</displaySubGroup>
<tabIndex>1</tabIndex>
<toolTip>Select/Enter a manufacturer</toolTip>
</control>
<control>
<controlType>TextBox</controlType>
<displayText>Part Number</displayText>
<databaseField>Part_Number</databaseField>
<databaseLookUp></databaseLookUp>
<displayGroup>1</displayGroup>
<displaySubGroup>2</displaySubGroup>
<tabIndex>2</tabIndex>
<toolTip>Enter part number</toolTip>
</control>
</controls>
<reports>
<report>
<reportName>All Records</reportName>
<selectCommand>select * from main</selectCommand>
</report>
</reports>
</MultiBase>
This gives more flexibility, in that you can associate one or more reports to a single form/database...
Hope this helps!!!
<HR><i><b>Regards,
Sidhu</b>
IF YOU DON'T HAVE ANYTHING TO SAY, WELCOME TO THE CLUB</i>
<font color=red>
<a href="http://www.DotnetAtWork.co.nr">Dotnet @ Work</a> Where Dotnet works...</font>
<a href="http://gundavarapu.blogspot.com">My Blog</a>
|
|
|
|
|
Have you seen MyXaml[^]? It does xml object graph instantiation (declarative programming) for generating GUI's, etc., and as a general reflection instantiator, you can create your own classes to support your reporting needs in the same xml file.
Marc
My website
Latest Articles:
Object Comparer
String Helpers
|
|
|
|
|
I am working on a database application that I call MultiBase. The jist of the application is that it will load a database and create a GUI to interact with it. The application also impliments search and reporting capabilities. The application is currently a winform application, but I plan on implimenting a web interface at a later date.
I have started writing a DLL to handle the database access. I'm lost as to if I want my DLL to return a dataset and then have a seperate class (? business logic ?) handle the bindings (and currency manager) or if I want to just return a datarow and somehow bind that to my winforms controls (don't think I can bind a datarow to a control, I would have to come up with some other way).
So my question is: In implimenting a n-tier (or 3 tier) applicaion what is the best way to present the data from the data tier to the presentation tier (via the business logic tier ?) ?
I'm thinking of returning a dataset to my record class (that handles the bindings and currency manager) If a new record is added, then send the dataset back to the data tier via the record class (which I would call my business logic).
Any thoughts?
www.lovethosetrains.com
|
|
|
|
|
Hai,
I am having an application with vb.net.But for some functionality(since the drawbacks of vb)I need to use c#. Is it possible to use c# in vb.net project.
If possible How I can include, and can I debug the project directly(Seperate compilation required?)?.
I am sure ,some body can advice me with details and that will be very helpful for me.
Thank you,
Rahul
|
|
|
|
|
Rahul.P.Menon wrote:
I am having an application with vb.net.But for some functionality(since the drawbacks of vb)I need to use c#.
*grin* I'm not touching this.....
You need to create a C# class library, which you can then import as a reference in your VB.NET project, and then you can import the C# projects namespaces and call it's methods. This will mean you will ship with a dll containing the C# code. If you want to move your entire project to C#, there are some excellent VB.NET -> C# converters available.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hai Christian Graus,
Thanks much.I will try that way.One more doubt I am having,How to create a class library in C# for a particular class?
Thank you.
Rahul.
|
|
|
|
|
A class library is a project that compiles to a dll and has no entry point ( no static void main ). You can put any classes in there that you like.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus ,
Thank you very much for the valuable information.
Thank you,
Rahul
|
|
|
|
|
Christian Graus wrote:
*grin* I'm not touching this.....
Good boy! Because of you, there's just no that much free space in the forums anymore!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Because of you, there's just no that much free space in the forums anymore!
*grin* Well, there are times I think the same about you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Rahul.P.Menon wrote:
since the drawbacks of vb
Im interested to know what you think can only be done in C# that cant be done in VB.NET - they are essentially the same language with a different syntax.
|
|
|
|
|
Really? VB.NET doesn't support "unsafe" or pointers. But, when there's will, there's a way...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Wrong - C# has pointers, overloaded operators, etc. On the other hand, VB.NET apparently has optional parameters.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How these two function saperate and run for voice. Which of these functions parameter use for voice.
The two functions are:
1: int ISampleGrabberCB.BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen )
2: int ISampleGrabberCB.SampleCB( double SampleTime, IMediaSample pSample )
|
|
|
|
|
What are you trying to do exactly ? What SDK did these API calls come from ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How In this function voice run "int ISampleGrabberCB.SampleCB( double SampleTime, IMediaSample pSample )" .
And how it can be saperated for voice.
|
|
|
|
|
Hey everybody I get this error on my program only when I put a picture on it. Can anyone tell me why this is happening? The second I put one picture on it crashes.
//
An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll
Additional information: DragDrop registration failed.
//
|
|
|
|
|
Hi!
What do you mean by "I put a picture on it"?
In a designer? Drop an image on your application? Anything else?
What else can you "put on" your program to make it not crash?
mav
|
|
|
|
|
I can put just about anything on it. Only when I try to put a picture as a background image or insert a picture box and stick a picture in it does it come up with the error message. I even tried using a label and putting the picture in there but got the error message. I have tried many different pictures also to see if it makes a difference but still no luck. As long as I don't insert a picture the program works.
|
|
|
|
|
Try stripping down the program to the absolute minimum to find out when the exception doesn't occurr any more.
Or create a new project and re-create the parts of your app likely to cause the trouble.
I've created a Form, enabled Drag&Drap for it and placed a picturebox and several other controls on the form, but couldn't experience the behaviour you get.
Perhaps such a minimal project will help...
Regards,
mav
|
|
|
|
|
hi to all,
i have made a console app to test the new functionality of the SerialPort in the new .NET, it works fine when run as a console application, so i converted it to a service, but it doenst launch the MASTER_PROCESS that is defined.
The idea is that the service is always running, and it sends data from the serail port to the application that is the database frontend, but if the user closes the front end (for somereason) the service reopens it when the serial port receives any data.
This works as console app, but the app (notepad) wont open when running as service.
any idea pls?
<code>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.IO.Ports;
using System.Threading;
namespace SerialPortListener
{
partial class PortListener : ServiceBase
{
#region Private Members
/// <summary>
/// The serial port object to read the data from
/// </summary>
private SerialPort port = null;
/// <summary>
/// the thread that will run, and monitor the port for activity
/// </summary>
private Thread monitorThread = null;
/// <summary>
/// The thread state, alive or dead, alive = true.
/// </summary>
private bool alive = false;
/// <summary>
/// The proccess executable that is the master program that requires
/// the input from this port monitor
/// </summary>
private const string MASTER_PROCESS = "notepad.exe";
#endregion
#region Constructors
/// <summary>
/// Default Constructor
/// Instantiates the serial port using the default values
/// </summary>
public PortListener()
{
InitializeComponent();
this.port = new SerialPort();
this.monitorThread = new Thread(new ThreadStart(MonitorPort));
}
#endregion
#region Thread Members
/// <summary>
/// Starts the thread to listen to the serial port
/// </summary>
protected override void OnStart(string[] args)
{
// start the thread
this.monitorThread.Start();
}
/// <summary>
/// Stops the thread that is listening to the serial port, using Thread.Abort()
/// </summary>
protected override void OnStop()
{
if (this.monitorThread.IsAlive)
{
this.alive = false;
this.monitorThread.Abort();
}
}
/// <summary>
/// Thread method that will monitor the port and handle the data from the port
/// </summary>
private void MonitorPort()
{
this.alive = true;
// loop while the bool is set true, if set false the thread will terminate
while (this.alive)
{
try
{
Thread.Sleep(100);
this.port.Open();
// check if master program is running
if (!IsRunningProcess(MASTER_PROCESS))
{
this.StartMasterProcess();
}
String data = this.port.ReadLine();
this.port.Close();
}
catch (Exception e)
{
Console.WriteLine("EXCEPTION: " + e.Message);
}
}
try
{
// kill the thread
this.monitorThread.Abort();
}
catch (Exception e)
{ }
}
#endregion
#region Private Helpers
/// <summary>
///
/// </summary>
/// <param name="processName"></param>
/// <returns></returns>
private bool IsRunningProcess(String processName)
{
Process[] p = Process.GetProcessesByName(processName);
if (p.Length == 0)
{
return false;
}
return true;
}
private void StartMasterProcess()
{
Process p = new Process();
p.StartInfo.FileName = MASTER_PROCESS;
p.Start();
}
#endregion
}
}
</code>
Kind regards,
g00fy
|
|
|
|
|
forgot to mention that the Service is installed and being able to start stop wuthout problems
sorry for lengthy post, will link to text file next time
regards,
g00fy
|
|
|
|
|
OK
notepad.exe is starting (by checking taskmgr) but it is not being displayed as a window anywhere only as a process, is there a way to do this from a service, like it worked when run from cmd line ?
also everytime i swipe a card, it is spawning another notepad.exe process, this also did not happen when run from cmd line.
NB, notepad is only for testing, eventually this will be the database frontend.
how do you debug services from VS.NET IDE ? cause when i try to it says service is already running, but if you stop it, the IDE says that you cant start service from debugging session
regards,
g00fy
|
|
|
|