|
The Undefeated wrote:
but i want to do 100*1.5^ anything between 1, and 100
This may help :
Random r = new Random();
double result = Math.Pow(100*1.5,Convert.ToDouble(r.Next(1,100)));
|
|
|
|
|
I've read in the 'documentation' that Crystal Reports supports passing parameters to the reports. I've also seen within the report generator IDE that I can select a value of any specific field as a filter / search criteria. I would like to combine these two features. I would like to be able to specify that <fieldname> = <parameter1> when invoking the report within my application. Is this possible?
Thanks.
|
|
|
|
|
I have been working on this for about 8 hours, and I have been looking on the web for about two days and I haven't found any one that has this same problem.
I have just taken over a project that is going to be using a C# client that connects to a C++ server side console application (I'll call it "the proxy" from here on) that takes a request from the client, queries a database and then returns the results.
The old client is written in VB6.0 and new the client that is almost done is written in C#. The new client is almost done, but it is accessing a test Database directly (probably because the programmer before me couldn't connect to the proxy either).
This is my Error dialog:
Error Dialog:<br />
<br />
Error: 10061<br />
Execption: <br />
Native Error: 10061<br />
Target: Void Connect(System.Net.EndPoint)<br />
Source: System<br />
<br />
StackTrace:<br />
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)<br />
at WindowsApplication1.frmConnect.btnConnect_Click(Object sender, EventArgs e) in c:\temp_data_store\tempest\tempest5\clisrv4\windowsapplication1\frmconnect.cs:line 158
I created a C++ client that only has the connection method using WinSock and it connects just fine no matter where on the network (or even off the network), the client and/or the proxy is.
This is my code in C# for a connection:
<br />
Socket mySock;<br />
IPAddress srvIP;<br />
IPEndPoint srvEnd;<br />
<br />
srvIP = IPAddress.Parse("127.0.0.1");<br />
srvEnd = new IPEndPoint(srvIP, 8765);<br />
mySock.Connect(srvEnd);
I have tried binding the socket, but when both are running on my local machine it throws the port already bound exception and when they are on seperate machines it throws that same 10061 error.
Is there a better way to connect to a C++ socket using C#, because if I have to write a .dll, rewrite the Client in C++ or add another thread to listen to the C# client then I need to get it done soon.
Thank you for your time.
What ever doesn't kill you... you live through.
<edited some="" spelling="" grammar="" errors="">
|
|
|
|
|
Well, not fully understood your exact situation, so I'll try to recap first
you have some server application running on some machine (eg. yours) and listening on port 8765.
Hmm. Binding local part of tcp socket to specific port makes usualy no sense.
What I would try first is to fire-up telnet.exe and try to connect to the address/port you are connecting to. In your case telnet 127.0.0.1 8765 (in case this is the address you can connect to with old client)
- If this can connect, problem is definitelly in your c# connection code.
- If the telnet connection fails, try to connect to 127.0.0.1 15650
- If the connection to port 15650 succeeds, problem is in the C++ server and old client
So let me know what case is yours, that we can find some cure for that
|
|
|
|
|
Telnet won't connect through the port I am using for the app. or port 15650. I have tried connecting to both ports on both my local machine and the test server. My mini program that I made in c++ using Winsock, succeeds in connecting and sending and receiving data through the connection.
So I'm thinking of just making a c++ program that the c# program will use to send and receive data from the server program.
What ever doesn't kill you... you live through.
|
|
|
|
|
Well this is really weird. Telnet does in principle exactly the same thing you do in C++. Did it wrote something like cannot connect to the remote host or whatever? Normal reaction of telnet is that it does nothing after sucessfull connect (try connecting through telnet to some http server eg. telnet www.codeproject.com 80)
Telnet as well as C++ and C# all together uses winsocks to connect to the server, so it seems to me very strange, that you succeed to connect with c++ but not with telnet console.
The C++ winsock stub can be workable work-around, but I'll think about it twice related to the cost of marshalling data to and from c# (depends on the amount of the traffic). I would be carefull here.
|
|
|
|
|
This is really wierd, must be something with my machine and the test server.
There is a software fire wall on my machine, but I made sure that it is not blocking the port, the server is NT2k Server, and the port that I am using is not being blocked. I am trying to find out if the Network is blocking certain applications or data transfers on certain ports, but it will be some time tomorrow before I get a reply.
Still, that doesn't explain why my cheesy little C++ Winsock program is allowed to connect, send and receive data, when the C# program and Telnet are denied.
Telnet test to test server:
<br />
H:\>telnet xxx.xxx.xxx.xxx 8765<br />
Connecting To xxx.xxx.xxx.xxx...Could not open connection to the host, on port 8765: Connect failed<br />
<br />
H:\>telnet xxx.xxx.xxx.xxx 15650<br />
Connecting To xxx.xxx.xxx.xxx...Could not open connection to the host, on port 15650: Connect failed<br />
Telnet Test to Local Machine:
<br />
H:\>telnet 127.0.0.1 8765<br />
Connecting To 127.0.0.1...Could not open connection to the host, on port 8765: Connect failed<br />
<br />
H:\>telnet 127.0.0.1 15650<br />
Connecting To 127.0.0.1...Could not open connection to the host, on port 15650: Connect failed<br />
What ever doesn't kill you... you live through.
|
|
|
|
|
So did you find something about the firewall?
I would also check on the server machine, what is the actual port the server listens on - for that the TCPView utility from www.sysinternals.com [^]would be of use.
Or simple netstat -a -n on the server will do the thing, although, here it's much difficult to match the listenning port to the actual process.
|
|
|
|
|
I have a ListView control in my application which allow users to add new items to the list and later modify the label of the item displayed in the list. I set the LabelEdit property to true to make the ListView control editable.
Now, the problem is that when users add a new item to the list, they have to "double click" on the ListViewItem in order to turn it into the editing mode and then change the value to whatever they want. What I want instead is to put the the item into editing mode right after a new item's been added without requiring the users to double click on the item.
I've been googling and searching in MSDN for hours but without any luck. Could anybody point me to the right direction?
|
|
|
|
|
After adding the ListViewItem you can call ListViewItem.BeginEdit , which places the item in edit mode.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Does anyone know how to implement a class that can forward a port ?
it should for example when a http request on a port of the pc who is running the application forward is to a pc that is running a webserver and send the data back to the pc who send the http request.but i should be able to forward any type of connection like when you forward any connection to pc on a network using your router. so also ftp,vnc and such
|
|
|
|
|
You've just described a firewall. Is there some reason why you couldn't use something off the shelf?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a datagrid that has a checkbox column. I want to know if it is possible to group a datagrid, so that the checkbox would only show up next to order numbers, and the person would not have to click on each checkbox next to a child row of that order. Once they click on the checkbox next to the order number, that would affect any child row of the order number.
Scott Moore
|
|
|
|
|
If you have established a DataRelation between the parent and child DataTable s - and presumably you have since you are either using parent/child navigation or master/detail DataGrid s - then you can handle an event when data changes for a row, get related child rows, and mark them all as being selected.
The easiest way is to have a boolean column for each of the parent and child rows of the DataTable s in question. After assigning your DataTable (or DataSet with the DataGrid.DataMember set to the table name, which I recommend) handle the DataTable.ColumnChanged event. When that's fired you get a DataColumnChangeEventArgs.Row that gives you the specific row. On that, call DataRow.GetChildRows - passing in the data relationship name (or instance) that relate the parent and child tables. That returns you a DataRow[] array that you can loop through and set each row's boolean column you want set.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Suppose I have a simple class called MyClass that contains nothing more than
an "int x" and "set" and "get" properties.
Now I create a WinForm1 with a text box and an "OK" button that will output MyClass' "int x" in a Message Box.
Question: Where in the project does "MyClass" go?
Question: Anything else I should know(namespaces etc...)?
--thanks
|
|
|
|
|
I would HIGHLY recommend picking up a book on C#. The questions you're asking are really beginner level. Also, your reference to "Anything else I should know?" would take an enormous amount of space in the forums to explain.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So you don't know where to put a user defined class in a WinForm,
project I take it.
I didn't know beginner questions weren't allowed, but thanks anyway...
|
|
|
|
|
Yes, I do. The problem is, there just isn't any one place to put them. Traditionally, class definitions should go into it's own files. What happens after that is FAR more material than anyone would want to put into a post.
The book recommendation is to answer al the basic questions and they make a very handy desk-reference while your learning the basics.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave- The proverbial "light bulb" just went on.
One obvious way- simply declare user defined class
within the Form namespace and then one can instantiate an object
within the code that will fire the event etc...
Apologize for the terse reply. I haven't done this stuff in over a year
and I'm trying to keep far away from the Console Window....
|
|
|
|
|
SkunkedWorks wrote:
I didn't know beginner questions weren't allowed
Beginner questions are allowed. However your questions were quite open.
SkunkedWorks wrote:
Where in the project does "MyClass" go?
Pretty much anywhere you like. As Dave said, a class usually goes in a file of its own. There is nothing to enforce this, it is just a convention that everyone uses. However, there are exceptions to the rule which would be better discussed in a good book on the subject. This whole area would probably take a chapter out of the book.
SkunkedWorks wrote:
Anything else I should know(namespaces etc...)?
Since we don't know what you do know, we wouldn't know where to start. This information would probably take the remainder of what ever book you get.
The types of questions that work best in a forum are those that only require a short(-ish) answer. Obviously, as you are a beginner you can't tell in advance the scope that your question is in, so don't worry too much about it. People will tell you when your question is best answered by reading a book, or point you in the direction of a relevant article on the subject - I've created articles here and have entries on my blog to point people to for common questions that arise over and over that take more time than a normal forum post would allow. This way I can be more help than I otherwise would have had the time to be.
I hope this is of some help and you are at least encouraged that people will try and help when they can.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Colin and Dave are right, one can only guess what you want, or link you to MSDN[^]. Reference and tutorials are there, but maybe not as friendly as a book. OTOH I have no book about .NET, most of things I've learned on the internet... but one must have enough time
Here is my guess:
class WinForm1: System.Windows.Forms.Form
{
...
private MyClass _mc;
...
}
This is only one of many interpretation of your question. Does it help?
David
|
|
|
|
|
hello my Article updated by myself if wants to benefit search for author Ahmad or search for xml guest book
Ahmed Erarslan
MCAD,MCDBA,MCP
MCSD.NET
|
|
|
|
|
Since you keep posting these update notifications, a quick review...
First, don't vote 5 on your own article. You come off patting yourself on the back, especially when this is not an "article." It's a few code snippets with no explanation of the theory and logic behind the code! Before you can call this an article, you've got a lot more work to do to explain what this is, what it does, the theory behind the code and why.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i've created a file .mfl.
I want by clicking of this kind of file run my own application and pass the path of the file at some internal function.
Someone can help me?
|
|
|
|
|
You need to set up a file association and you can do this programmatically by accessing the registry using the Microsoft.Win32.Registry and RegistryKey classes. Read Creating a File Association[^] in MSDN for more details.
If you plan on deploying your application, I suggest you create a Windows Installer project in your solution to install your project output files. You can create file associations in the product by following the direction in File Types Management in Deployment[^] in the Visual Studio .NET product documentation.
When a user double-clicks the file with your registered extension it is passed as the first argument to your Main function, so you could do something like in the following example:
class MainForm
{
static void Main(string[] args)
{
MainForm form = new MainForm();
if (args.Length > 0) form.OpenDocument(args[0]);
Application.Run(form);
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|