|
Is this possible? I'm using Visual Studio Enterprise Edition and I do have Visio 2002 installed here as well. I know how to use UML to create the diagrams, I just don't know where the code generation feature is...
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
menu->
"UML"
then
"CODE"
then
->"Generate"
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hello
i need help on how to convert xsl:fo or xml document to pdf using c sharp
i BADLY need that.
Asim
|
|
|
|
|
|
Try changing the procedure to:
CREATE PROCEDURE Get
@ID PK_SMALLINT = NULL
Select * from Table
where ( (@ID IS NULL) or (ID = @ID) )
|
|
|
|
|
I try to subclass a window using WinAPI but I get a problem on the function declaration in DLLImport. Please help me if you can. Thanks anyway.
|
|
|
|
|
MSFT Eric Gunnerson article on win32 interop[^].
You should also post the exact function names you are trying to interop.
How low can you go ? (MS rant)
|
|
|
|
|
Hi there,
here is my problem: i need a certain class to be used in a webmethod an a client. In order to do so i made a little library called ChatLib containing the class ChatMsg. Both, webservice and client, have the line "using Chatlib;", but the proxy (which is generated by the Visual Studio) seems to do something different.
The Compiler tells me that he is not able to convert 'chatclient02.localhost.ChatMsg' to 'ChatLib.ChatMsg' (referring to a line in the windows form, where i want to start the webmethod).
(in german: "Implizite Konvertierung des Typs 'chatclient02.localhost.ChatMsg' zu 'ChatLib.ChatMsg' nicht möglich.")
exchanging the line "using Chatlib;" by "using chatclient02.localhost;" in the client makes the compiler happy but the program does not run properly which means that there are system exceptions thrown.
i would be grateful for every answer especially those, that support the usage of Visual Studio.NET
PS: I already posted this one on another board, which was probably the wrong address. If this is true for this board, too, i might be happy getting an answer such as: "this is the wrong board, try this: ...".
|
|
|
|
|
I guess you would have someone to answer you if you made your code available somewhere.
How low can you go ? (MS rant)
|
|
|
|
|
here you are, this is the library:
<br />
using System;<br />
<br />
namespace ChatLib<br />
{<br />
public class ChatMsg<br />
{<br />
public string content;<br />
public long authorid;<br />
public long messageid;<br />
<br />
public ChatMsg()<br />
{<br />
this.content = "";<br />
this.messageid = 0;<br />
this.authorid = 0;<br />
}<br />
public ChatMsg(string msg)<br />
{<br />
this.content = msg;<br />
this.messageid = 0;<br />
this.authorid = 0;<br />
}<br />
public ChatMsg(string msg, long number)<br />
{<br />
this.content = msg;<br />
this.messageid = number;<br />
this.authorid = 0;<br />
}<br />
public ChatMsg(string msg, long number, long id)<br />
{<br />
this.content = msg;<br />
this.messageid = number;<br />
this.authorid = id;<br />
}<br />
}<br />
<br />
}
this is the webservice:
<br />
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Diagnostics;<br />
using System.Web;<br />
using System.Web.Services;<br />
using ChatLib;<br />
<br />
<br />
namespace chatserver02<br />
{<br />
public class Service1 : System.Web.Services.WebService<br />
{<br />
<br />
private const int buffersize = 5;<br />
private static ChatMsg[] msgbuffer = new ChatMsg[buffersize];<br />
private static long lastid = 0;<br />
private static int lastpos = 0;<br />
<br />
private ChatMsg MsgNum(int pos)<br />
{<br />
if(pos >= buffersize)<br />
{<br />
ChatMsg nullmsg = new ChatMsg("", -1);<br />
return nullmsg;<br />
}<br />
int realpos = 0;<br />
realpos = (lastpos - pos)%buffersize;<br />
return msgbuffer[realpos];<br />
}<br />
<br />
public Service1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
#region Component Designer generated code<br />
<br />
private IContainer components = null;<br />
<br />
private void InitializeComponent()<br />
{<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if(disposing && components != null)<br />
{<br />
components.Dispose();<br />
}<br />
base.Dispose(disposing); <br />
}<br />
<br />
#endregion<br />
<br />
<br />
[WebMethod]<br />
public ChatMsg Horch(long lastmsg)<br />
{<br />
<br />
<br />
<br />
if(lastmsg < (lastid - buffersize))<br />
{<br />
lastmsg = lastid - buffersize;<br />
}<br />
<br />
ChatMsg returnmsg = new ChatMsg("", lastid);<br />
<br />
if(lastmsg < lastid)<br />
{<br />
while(lastmsg < lastid)<br />
{<br />
returnmsg.content = returnmsg.content + MsgNum((int)lastid - (int)lastmsg).content;<br />
lastmsg ++;<br />
}<br />
return returnmsg;<br />
}<br />
else<br />
{<br />
return new ChatMsg("", lastid);<br />
} <br />
}<br />
<br />
[WebMethod]<br />
public int Verkuend(string text)<br />
{<br />
lastid = lastid + 1;<br />
ChatMsg newmsg = new ChatMsg(text, lastid);<br />
newmsg.content = newmsg.content + "\n\n";<br />
lastpos = (lastpos + 1)%buffersize;<br />
msgbuffer[lastpos] = newmsg;<br />
return 0;<br />
}<br />
}<br />
}<br />
and this is the client:
<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
using ChatLib;<br />
<br />
namespace chatclient02<br />
{<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
public static Form1 me;<br />
<br />
private long mylastmsg = 0;<br />
<br />
private System.Windows.Forms.TextBox inbox;<br />
private System.Windows.Forms.Button sendbutton;<br />
private System.Windows.Forms.TextBox outbox;<br />
private System.Windows.Forms.Button startbutton;<br />
private System.Windows.Forms.StatusBar feedbackbar;<br />
private System.ComponentModel.Container components = null;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if (components != null) <br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
private void sendbutton_Click(object sender, System.EventArgs e)<br />
{<br />
localhost.Service1 pf = new localhost.Service1();<br />
<br />
AsyncCallback cb = new AsyncCallback(Form1.donothing);<br />
<br />
IAsyncResult ar = pf.BeginVerkuend(inbox.Text, cb, pf);<br />
<br />
<br />
<br />
<br />
inbox.Text = "";<br />
inbox.Focus();<br />
<br />
feedbackbar.Text = "sende botschaft...";<br />
}<br />
<br />
public static void donothing(IAsyncResult ar)<br />
{<br />
localhost.Service1 pf = (localhost.Service1) ar.AsyncState;<br />
me.feedbackbar.Text = "botschaft gesendet";<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.inbox = new System.Windows.Forms.TextBox();<br />
this.sendbutton = new System.Windows.Forms.Button();<br />
this.outbox = new System.Windows.Forms.TextBox();<br />
this.startbutton = new System.Windows.Forms.Button();<br />
this.feedbackbar = new System.Windows.Forms.StatusBar();<br />
this.SuspendLayout();<br />
this.inbox.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) <br />
| System.Windows.Forms.AnchorStyles.Right);<br />
this.inbox.Location = new System.Drawing.Point(0, 152);<br />
this.inbox.Multiline = true;<br />
this.inbox.Name = "inbox";<br />
this.inbox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;<br />
this.inbox.Size = new System.Drawing.Size(288, 48);<br />
this.inbox.TabIndex = 0;<br />
this.inbox.Text = "";<br />
this.sendbutton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);<br />
this.sendbutton.Location = new System.Drawing.Point(144, 200);<br />
this.sendbutton.Name = "sendbutton";<br />
this.sendbutton.Size = new System.Drawing.Size(144, 32);<br />
this.sendbutton.TabIndex = 1;<br />
this.sendbutton.Text = "send";<br />
this.sendbutton.Click += new System.EventHandler(this.sendbutton_Click);<br />
this.outbox.AcceptsReturn = true;<br />
this.outbox.AllowDrop = true;<br />
this.outbox.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) <br />
| System.Windows.Forms.AnchorStyles.Left) <br />
| System.Windows.Forms.AnchorStyles.Right);<br />
this.outbox.BackColor = System.Drawing.SystemColors.Window;<br />
this.outbox.Multiline = true;<br />
this.outbox.Name = "outbox";<br />
this.outbox.ReadOnly = true;<br />
this.outbox.RightToLeft = System.Windows.Forms.RightToLeft.No;<br />
this.outbox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;<br />
this.outbox.Size = new System.Drawing.Size(288, 152);<br />
this.outbox.TabIndex = 2;<br />
this.outbox.Text = "";<br />
this.startbutton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);<br />
this.startbutton.Location = new System.Drawing.Point(0, 200);<br />
this.startbutton.Name = "startbutton";<br />
this.startbutton.Size = new System.Drawing.Size(144, 32);<br />
this.startbutton.TabIndex = 3;<br />
this.startbutton.Text = "start session";<br />
this.startbutton.Click += new System.EventHandler(this.startbutton_Click);<br />
this.feedbackbar.Location = new System.Drawing.Point(0, 238);<br />
this.feedbackbar.Name = "feedbackbar";<br />
this.feedbackbar.Size = new System.Drawing.Size(288, 16);<br />
this.feedbackbar.TabIndex = 4;<br />
this.feedbackbar.Text = "...";<br />
this.AcceptButton = this.sendbutton;<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(288, 254);<br />
this.Controls.AddRange(new System.Windows.Forms.Control[] {<br />
this.feedbackbar,<br />
this.startbutton,<br />
this.outbox,<br />
this.sendbutton,<br />
this.inbox});<br />
this.MinimizeBox = false;<br />
this.Name = "Form1";<br />
this.Text = "Form1";<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
me = new Form1();<br />
Application.Run(me);<br />
}<br />
<br />
private void startbutton_Click(object sender, System.EventArgs e)<br />
{<br />
localhost.Service1 pf = new localhost.Service1();<br />
<br />
AsyncCallback cb = new AsyncCallback(Form1.incomming);<br />
<br />
IAsyncResult ar = pf.BeginHorch(mylastmsg, cb, pf);<br />
<br />
feedbackbar.Text = "erwarte daten von " + ar.ToString();<br />
}<br />
<br />
public static void incomming(IAsyncResult ar)<br />
{<br />
localhost.Service1 pf = (localhost.Service1) ar.AsyncState;<br />
ChatMsg ergebnis = pf.EndHorch(ar);<br />
<br />
<br />
if(me.mylastmsg != ergebnis.messageid)<br />
{<br />
me.feedbackbar.Text = "habe daten empfangen";<br />
me.mylastmsg = ergebnis.messageid;<br />
me.outbox.AppendText(ergebnis.content.Replace("\n","\r\n"));<br />
}<br />
<br />
me.feedbackbar.Text = "erwarte daten...";<br />
<br />
System.Timers.Timer aTimer = new System.Timers.Timer();<br />
aTimer.Elapsed+= new System.Timers.ElapsedEventHandler(OnTimedEvent);<br />
aTimer.Interval = 250;<br />
aTimer.AutoReset = false;<br />
aTimer.Enabled = true;<br />
}<br />
<br />
public static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)<br />
{<br />
localhost.Service1 pf = new localhost.Service1();<br />
AsyncCallback cb = new AsyncCallback(Form1.incomming);<br />
<br />
IAsyncResult arn = pf.BeginHorch(me.mylastmsg, cb, pf);<br />
}<br />
}<br />
}<br />
hope this might help...
PS: the code is a bit messy i guess, parts of it are from the VS help, anyway, the compiler has its problem with this line, where i want to start the webmethod:
IAsyncResult ar = pf.BeginHorch(mylastmsg, cb, pf);<br />
|
|
|
|
|
I found a solution when i made a little exsample application concentrating on this whole using library business (for a prof who did not quite understand my problem):
It turns out to run properly when i refer to ChatMsg as localhost.ChatMsg (i think it's the namespace of the proxy) not using or refering any ChatLib in the client. This might not have worked for the original purpose because of the messy code, i have to tidy it up i guess
Greetings and sorry for the code
|
|
|
|
|
Hi! I've been working with C# for a while now but have hit a few snags...I would sure like info about the following things:
1. Hardware and C#
2. Accessing hardware serial numbers in C#
3. Computer System Hardware Classes and C#
4. Accessing Win32_BIOS - Win32_DiskDrive functions in C#
5. How to get a list of functions contained in a DLL file
Any help would be appreciated and thanks for the time spent on answering this beforehand...
Fahad
<fahad_khalil@msn.com>
|
|
|
|
|
For anything Win32 related you should go to MSDN[^] and check out Eric Gunnerson's latest article. He has a really good explanation of how to do Win32 stuff from C#.
As for the hardware related issues...I don't think you can do that in C#. I believe you would have to use, again, the Win32 API. However, you may not even be able to do that(You might have to go all the way down to Assembler).
And lastly, as for the DLL. You can use the System.Reflection.Assembly class to load a DLL and examine it's properties and methods. Even if it's a COM DLL, then .NET will create a wrapper for you and you'll be able to see the info that you want.
Hope this helps.
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
|
|
|
|
|
The fact you would use C# is questionable. You need low-level here, that's definitely not what .NET is about.
How low can you go ? (MS rant)
|
|
|
|
|
HI
Have alook at WMI and the System.Management namespace. There is an article on CP (but I'm to lazy to search) , just search for WMI C#.
I think that should provide all the answers u need
"There are no stupid question's, just stupid people."
|
|
|
|
|
I was reading some stuff on MSDN and I was wondering if anyone could tell me the difference between a property and a field?
|
|
|
|
|
I think not even MS can
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Well I looked but I couldnt understand why you would use a property instead of a field and visa-versa.
|
|
|
|
|
A property allows you to add additional login before getting or setting values. A field is for direct getting and setting of values.
|
|
|
|
|
|
Hi
Properties are a replacement for all those get/set methods we have in C++ / Java. It also allows you to expose a different type than the field you setting. AFAIK any fields should be never be public.
Hope this helps
"There are no stupid question's, just stupid people."
|
|
|
|
|
Wow, this seems to be a good definition!
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Yeah, its best to use properties rather than public fields. A property acts as an encapsulation around and a buffer between a classes private fields and the function accessing them.
Where with a public field all you can do is get and set:
class Test
{
public int ABool = 0;
}
Test t = new Test();
t.ABool = 1;
A property allows you to do many things before the field itself is set. A property also allows you to restrict the access to a field, allowing only getting or setting, if that is what your class requires:
class Test
{
private int aBool = 0;
public int ABool
{
set
{
// restrict the value of aBool to positive and zero
if (value >= 0)
{
aBool = value;
}
}
get
{
return aBool;
}
}
}
Test t = new Test();
t.ABool = -1;
|
|
|
|
|