|
Of course you can. I remember the old ZIP drives that hooked up to the parallel port and took forever to read and write.
My message seemed to be truncated (or I just forgot to hit update ). My point is that when you connect a device to the port, it will need some kind of driver. Then you can interface with that driver.
|
|
|
|
|
VS05 provides a class for the parallel port. IIRC it's in the system.io.ports namespace that should allow you to write to it. If you're using VS02 or 03, you'll have to google up a 3rd party implementation. Try the articles here as a starting point.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Thanks for the reply. i tried using system.io.ports namespace. But its showing only serial ports data. What should i do to send to both com1 and LPT1 ports? How can i check whether it is open?
Regards
Hari
|
|
|
|
|
I developed an Add-in for Outlook 2003 with Visual Studio 2005 Team Suite.
My solution was created via:
Other Project Types -> Extensibility -> Shared Add-in
And I selected support for Microsoft Outlook.
Question 1:
I uncheched all the "Exclude" option of the assemblies in the Setup Project and builded it successfully.
The Add-in installed and ran well in another computer which had also VS 2005 Team Suite on it. However, on a third computer, which only had .NET Framework 2.0 but not VS 2005, the Add-in installed normally but did not load when Outlook started. What's the problem?
Question 2:
My CommandBarButton runs only a few times.
I added a CommandBarPopup to the Main Menu and then added a MsoControlType.msoControlButton to the popup. In the ClickEventHandler of the button, a Windows Form object is created and shown.
The problem is, each time I start Outlook, the button is available for only a few times, usually 2-3 times, sometimes only once. Afterwards it becomes unavailable at all. It gives no response when I click it.
Some of the codes are as follows:
//Acquire the "Menu Bar" and create a new control on it
menuBar = ((Outlook.Application)applicationObject).ActiveExplorer().CommandBars["Menu Bar"];
commandBarControl_CM = menuBar.Controls.Add(MsoControlType.msoControlPopup, 1, "", 6, true);
commandBarControl_CM.Visible = true;
commandBarControl_CM.Caption = "Sychronization";
//Add buttons to the newly created control
CommandBarPopup commandBarPopup_CM = (CommandBarPopup)commandBarControl_CM;
CommandBarControl commandBarControl_SI = commandBarPopup_CM.CommandBar.Controls.Add(
MsoControlType.msoControlButton, 1, "", 1, true);
commandBarControl_SI.Visible = true;
commandBarControl_SI.Caption = "Calendar Sychronization";
//Add button event handlers
CommandBarButton button_showinfo = (CommandBarButton)commandBarControl_SI;
button_showinfo.Click += new _CommandBarButtonEvents_ClickEventHandler(button_showinfo_Click);
private void button_showinfo_Click(CommandBarButton Ctrl, ref Boolean CancelDefault)
{
System.Windows.Forms.Form form_CalMng = new Form_CalMng();
form_CalMng.Show();
}
|
|
|
|
|
Question 2 has been solved. The button object has to be declared at class level.
But help me with Question 1, please!
|
|
|
|
|
I begin to believe that it has something to do with the developing environment. I tried the Add-in on two computers WITHOUT VS2005 and got the same result, which is that the Add-in did not load. However, I tried it on another two computers WITH VS2005 on them and the Add-in loaded successfully.
Any hint?
|
|
|
|
|
Hi All,
A project I am working on requires me to interface DCOM components on a Windows NT machine with a server running 2003 with .NET 2 on it.
The problem is I can't seem to find any good advice on how this can be done. Specifically the client can not change and thus I require something like a wrapper so that the client can create a connection to the server via DCOM, but the server will be dealing with it via .NET remoting.
Can anyone point me in the right direction of how this can be done?
Thanks
Andy
|
|
|
|
|
Hello again,
I have looked in the docs and searched the net, but either it can't be done, or I'm not looking in the right place.
I would like have a property that is deserialised, but is not serialised. Why? Well, imagine an XML doc that allows
<person fullname="John Smith"/>
and
<person firstname="Jane" lastname="Doe"/>
However, when serialized we always want fullname, as in:
<person fullname="John Smith"/>
<person fullname="Jane Doe"/>
How do I deserialise firstname and lastname in the input file, but keep them from being serialised in the output?
Thanks again,
Clive Pottinger,
Hamilton ON
|
|
|
|
|
|
Hi
I'm affraid that's impossible but you can have a computed property ( which concats the first name and last name and returns the full name) and you can ignore it using XmlIgnore attribute.
I mean:
<br />
[XmlIgnore()]<br />
public string FullName<br />
{<br />
get<br />
{<br />
return this.FirstName + " " this.LastName;<br />
}<br />
}<br />
<br />
Regards
|
|
|
|
|
beatles1692 wrote: Hi
I'm affraid that's impossible but you can have a computed property ( which concats the first name and last name and returns the full name) and you can ignore it using XmlIgnore attribute.
Thanks. That's too bad. I'll have to see what I can do about changing the specs.
Clive Pottinger,
Hamilton ON
|
|
|
|
|
Bonus - I solved two in one day.
You can have an attribute that is deserialised but not serialised.
Give the item a property with a DefaultValue attribute and then have the get method always return the default value:
<br />
[XmlAttribute("firstname")]<br />
[System.ComponentModel.DefaultValue("----")]<br />
public string Firstname<br />
{<br />
get<br />
{<br />
return ( "----" );<br />
}<br />
set<br />
{ <br />
this.Firstname = value;<br />
}<br />
}<br />
Voila! Now, when deserialising, firstname is parsed, but when serialising, the firstname attribute is never written. Works like a charm.
Clive Pottinger,
Hamilton ON
|
|
|
|
|
Hello everyone,
My questions is in regards to finding information for an ancestor item while deserialising an XML document. The following is similar to the problem I am facing:
<teacher name="Johnson">
<class name="Hydrodynamics 101">
<student name="Billy"/>
</course>
</teacher>
I have classes for objects Teacher, Class and Student.
When a Teacher is deserialised, all the Class objects are created and passed to Teacher.AddClasses where each class is added to a private ArrayList Teacher.ClassList. Additionally, the Class.TeacherName is set. So far so good.
But during the creation of the Class objects, C# needs to create the Student objects. So the Student objects are deserialised BEFORE the Class objects are passed to Teacher.AddClasses. We are getting there...
When a Student object is created, I wish to add the student to the ArrayList Teacher.StudentList. That is a problem. Because the Class has not yet been added to the Teacher and had the Class.TeacherName value set, the Student object is unable to find out which Teacher it should be added to. We can't even search the Teacher objects looking for one that has that Class in Teacher.ClassList, because the Class has not been added there yet either.
Does anyone know a way around this? Is there a way, during deserialisation, to find out the Student["billy"] belongs to Teacher["Johnson"]?
Note: This is not exactly the situation I am facing: it is just a simplified example. So, though it may seem easier to rearrange the XML into a better order, that is not going to be an option for me. I need to deserialise object C inside B inside A and add C to a value in A while doing so.
Many thanks in advance.
Clive Pottinger,
Hamilton ON
|
|
|
|
|
Isn't it possible to set the teacher name in AddClasses . You could simply iterate through the student list in the class and set the teacher name.
|
|
|
|
|
That is the essence of the problem - I don't see a way to do it.
I'll try adding some code - I'm away from my development environment at the moment, and doing this from memory, so don't laugh too hard at my syntax errors... (I'm sensitive)
<br />
public class Teacher{<br />
private ArrayList ClassList = new ArrayList();<br />
private ArrayList StudentList = new ArrayList();<br />
[XMLAttribute("name");<br />
public string Name;<br />
[XMLElement("class")]<br />
public Class[] AddClasses {
get {return new Class[0];}
set {<br />
foreach( Class newClass in (Class[])value) {<br />
newClass.teacher = this.Name};
this.ClassList.Add(newClass);
}<br />
}<br />
}<br />
<br />
public class Class {<br />
[XMLAttribute("name")<br />
public string Name;<br />
<br />
[XMLIgnore]<br />
public string teacher;
[XMLElement("student")]<br />
public Student[] AddStudent {
get {return new Student[0];}
set {<br />
foreach( Student newStudent in (Student[]value) {<br />
newStudent.ClassesToGoTo = this.Name;
newStudent.MyInstructors = ?
}<br />
}<br />
}<br />
<br />
public class Student{<br />
[XMLAttribute("name");<br />
public string Name;<br />
private ArrayList ClassesToGoTo = new ArrayList();<br />
private ArrayList MyInstructors = new ArrayList();<br />
}<br />
<\code><br />
<br />
I know it's not complete, but hopefully it will illustrate my dilemma. <br />
<br />
<br />
-- modified at 13:39 Monday 6th November, 2006 <br />
<br />
<div class="ForumSig">Clive Pottinger,<br />
Hamilton ON</div>
|
|
|
|
|
The specific sequence of operations I see happening is this:
teacher nodes begin deserialising
-- Teacher object is created (oops I forgot the constructors in my example)
---- Teacher name is deserialised: set to "Johnson"
---- teacher/class nodes begin deserialising
------ Class object is created
------ class name is deserialised: set to "Hydrodynamics 101"
------ teacher/class/student nodes begin deserialising
-------- Student object is created
-------- student name is deserialised: set to "Billy"
------ all Student objects created
------ Student[] passed to Class.AddStudent
-------- Student["Billy"].ClassesToGoTo is set ("Hydrodynamics 101" is added)
******** Student["Billy"].Instructor should be set to ("Johnson")
******** Teacher["Johnson"].StudentList should have "Billy" added
-------- All students in Student[] processed
---- all Class objects created
---- Class[] passed to Teacher.AddClasses
+----- Class["Hydrodynamics 101"].teacher is set (oops missed defining that too)
+----- Teacher["Johnson"].ClassList is set ("Hydrodynamics 101" is added)
------ all classes in Class[] processed
-- all Teacher objects created
-- Teacher[] passed to unspecified routine
done
Again, notice that the ***** lines for Student processing require information that is not set until the +--- lines when the Class objects are processed. That is my problem.
Clive Pottinger,
Hamilton ON
|
|
|
|
|
How about setting the teacher value when "Class["Hydrodynamics 101"].teacher is set" occurs? You obviously have the list of students subscribed to the class, so you could just iterate over it and assign the teacher property?
|
|
|
|
|
Thanks for the help everyone.
I finally managed to solve the problem.
Since the deserialisation is "serial", it only works on one element at a time, working its way down through the child items. I decided to take advantage of that. I created another class (to continue my previous example, let's call it SchoolInfo) and gave it a static member which I use to track the current item being deserialised.
So SchoolInfo.CurrentTeacher is set to the Teacher object by the Teacher class as is being constructed. Now all Class objects and Student objects can look at SchoolInfo.CurrentTeacher as they are being constructed or as their attributes are being deserialised - it tells them which Teacher they going to be assigned to before they are assigned.
It may not be the prettiest, but it works.
Thanks again.
Clive Pottinger,
Hamilton ON
|
|
|
|
|
i want to see code for Nearest neighbour algorithm
-------------------------
ex:
if i have 3 classes each one have X1 .X2,X3
and i have afile contain 100 pattren i choose 50 raqndomly to know in witch class
If I HaD OnE sInglE wIsh IwIll gO back for thE fIrst tIme i sEE yOu
|
|
|
|
|
Try explaining your specific coding problem - you have not done so.
This also sounds like homework! You'll get help but not the solution written for you (hopefully)
|
|
|
|
|
Also, please do not cross-post questions.
|
|
|
|
|
hi , could someone please help me out with the datagridviewer? i'm new to C# , dont have much of any idea about it. i'm building a booking program for a little hotel.
I need :
1. to have a context menu thats cell specific , i know i can use the datagrid contextmenu prop. or handle the cellcontextmenuneeded event , but if i right click on a cell the focus does'nt change to that cell , i have options on the menu that pertain to single cells like excel.
2. How do i restrict the user from adding new rows or deleting existing rows , but he should still be able to edit the text in the cells.
3. i have two tables , one is a status table with status for all rooms .. it has 2 cols. roomID and customerName. The second table is a customers table with all the cutomers details and customerName. Now the customerName col. in both the tables should be related , the datagridview has 25 rows each for a room , it should scan the status table for each room , and load the corresponding customers details into the datagridview. How do i make a relation and do the above?
i need this a little quick so please help!
Thanks in advance
Gideon
|
|
|
|
|
1 - it's a little tricky, give me some time to think about it.
2 - in the smart tag of the datagridview, uncheck "enable adding" option
3 - a binding source could help you.
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
hey , i got it!
i dont know much but it works perfect this way:
<br />
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)<br />
{<br />
dataGridView1.CurrentCell = DataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];<br />
this.dataGridView1.ContextMenuStrip = this.contextMenuStrip1;<br />
}
works only on this event ... and yes the contextStrip shows up when i right click . not when i left click
thanks so much for your concern!
but i got another problem now.. .basically.. .the datagrid on my form shoud display the status of ALL the rooms... for a given date(i have a datepicker on the form) .. ok so now in my test app. when i hit 8th on the datepicker , the DGV shows one entry .. room 103A is booked on that date. Problem is , it only shows one entry .. i want the empty rooms to show up as empty rows. I know i have to add unbound data. I tried to add blank rows. but its says i cannot add anythign programmatically if i have it bound.
If its unbound this is how i add the rows ..
DataRow dt = dataSet.Tables["customers"].Rows[0];<br />
dataGridView2.Rows.Add(dt[0] , dt[1] , dt[2] ....... );
is the above correct or is there a better way...??
also if i add the blank rows .. and the user adds something in it what event do i have to handle? and how do i update/add the DB manually? i know SQL .. i'm using oledb . for an access database (.mdb)
now one of the colums inthe database is roomtype. but then when i load the values i want them in a combobox? how do i do that? how do i adda combobox to the DVG?
DataGridViewComboBoxColumn cboColumn = new DataGridViewComboBoxColumn();<br />
cboColumn.Items.Add("a");<br />
cboColumn.Items.Add("b");<br />
dataGridView2.Rows.Add("", cboColumn, "");
i get -> DataGridViewComboBoxColumn { Name=, Index=-1 } in the second column!
plz help!
|
|
|
|
|
We're developing an application (.net 2.0 / C#) that interacts with Office and other external applications. So all needed references are added to Visual Studio's "References" and then used ("using x.y.z") in our sources.
This works fine but what if someone (an enduser) doesn't have say MS Project installed?
The sources won't compile, crying that "The type or namespace 'MSProject' does not exist ... (are you missing an assembly reference?)".
Is there any possibility to make a (prior) test if a reference is available or not? Something like a try/catch surrounding the "using" statement?
In fact we would like to test if MS Project (or another application) is installed and if not simply don't provide the functionality. I searched on MSDN, Google Groups, etc but did not find something useful...
Thank you very much for your help!
|
|
|
|