|
How can I create a named range in a C# excel report for cells that aren't lined up next to eachother?
I've seen examples on how to create a named range for consecutive cells (i.e. A1:M1), however the cells I need to name are scattered throughout the report (i.e. A1, H3, J9, S17, etc).
In excel, I could just do this by holding CTRL + click, but how can I do this in c#?
Thanks.
|
|
|
|
|
You can Create list of Range insted
List<Range> myrng = new List<Range>(20);
myrng.Add(excelWorksheet.get_Range("A1", "B3"));
and for one cell use Range like this:
Range rng1 = excelWorksheet.get_Range("A1", "A1");
then set property of each in loop
|
|
|
|
|
hi
sorry this is a reposting , but im in need od solution ASAp.
i need to find a way to know which application/process is using my com1 port.
|
|
|
|
|
I think you're being quite rude - so why should you get help ? If people dont answer your question, its generally becuase
a) the way you asked it - using 'asap' for example was incorrect
b) they dont know the answer
c) they are too busy to respond right now (there are very few full time staff on CP, mainly editorial, not content) - the rest of us inmates are volunteers who have jobs elsewhere !
So in future, watch how you ask the question and try to be a little self sufficient. fwiw, You can use the process explorer tool from SysInternals (now owned by Microsoft) to search for open handles. In this case you would want to search for 'Serial' since it uses device names that may not map to com port numbers. (e.g. COM1 is \Device\Serial0 on my system).
Sysinternals also have a tool called 'portmon', but I think that has to be running before anything (else) access the com port.
http://technet.microsoft.com/en-us/sysinternals/bb795533.aspx[^]
That information comes to you via Google - so if you had done a little work on your own you'd probably have had the answer by now ....
'g'
|
|
|
|
|
Im soo sorry about that, i was a bit stressed out about my work....thanks garth for your answer.
but i cannot download any of these softwares...ive got to write a program to find it
thanks so much
ani
|
|
|
|
|
cant download from MS Technet ? I'd tell someone at your work to pull their head out of their butt and allow the access so you can get the tools you need to do the job
aniarun wrote: ive got to write a program to find it
yeah, its called a browser, and MS have done it already ! you shouldnt have to write a downloader ... gawd, I often think I have a tough life !
'g'
|
|
|
|
|
thanx garth
ya, i meant that i have to write a program to find the praocess which is using my port lol.
man makes hisife hard :P
good luck
|
|
|
|
|
Why can't you download the software you need to do your job? That's ridiculous!
If you'd like to have portmon, click the 'email' link and let me know. If I can download it I'll be happy to email it to you. That should get past any work-imposed download blocks, assuming they're not monitoring your emails, too. Of course, if your boss demands that you write it, this won't do you much good... But we can try.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi thanks for that but im in need of writing one
what is \\Device\\serial0 is it the device name?? how do i know the name of it on a unknown machine(that is if i duno the available ports. my laptop gave me \\Device\\winachsf0)
thank you soo much
|
|
|
|
|
I'm not sure what that means, other than it is most likely the Windows internal name for the first serial port on the machine. You might find it beneficial to spend some time researching device driver development on MSDN. I don't know how much information is available there, but MSDN often contains a lot of clues about internal workings of the Windows system. If you can find them, of course. Try Google first.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I am creating a web service that will be called from a console application. I am having trouble creating objects in the console application in order to pass them to the web service.
I have Classes in the Web Site project that are similar to the following:
public class Product
{
//other product details
}
public class SubProduct : Product
{
//subproduct details
public innerObject io;
}
public class innerObject
{
//object details
}
The web service contains a function:
[WebMethod]
public string LoadProduct(Product[] p)
{
//does stuff here
if (p is SubProduct)
{
//do stuff specific to subproduct objects.
}
}
I want the console application to create an array of products and pass it to the web service. Each product in the array could be of type Product or SubProduct. The problem I am encountering is that SubProducts and the innerObject types are not a recognized or accessible in the console application. It seems like all that is imported from the web reference to the web service are the objects types that are listed in the parameter list of the web service methods.
Does anyone know how I can make the SubProduct and innerObject classes accessible from the web service code?
thanks.
|
|
|
|
|
Check the wsdl file to see if there are any additional attribute tags specified on SubProducts.
Note: A WSDL file can be viewed by entering the web service path followed by ? and wsdl (e.g. www.site.com/webmethod?wsdl).
There's nothing left in my right brain and nothing right in my left brain. |
|
|
|
|
|
Hey guys
I had this at the quick answers section but I'm moving it here cause this is more of a discussion than a particular problem.
I've only recently started looking at the .Net asynchronous programming model and I feel that I more or less get the concept. I've started throwing together a server & client that works more or less... But stress testing it yielded very strange results. I think there's something to this asynchronous model that I don't see
By stress testing I mean I have a single client(when this works I'll do the same with multiple clients) that sends plain text messages in an infinite loop. The loop has a counter so each message looks like this: 1: My plain text message \r\n[char 3] , [char 3] being the packet terminator.
I have a 2nd client that receives the messages and just appends them to a TextBox.
Notes:
0) I am using TCP so the packages are guaranteed, right?
1) The server, for now, is just an echo server... I takes a message and sends it to every
connected client except the one it originated from
2) All 3 apps are done using the asynchronous model
Now when I run all these apps I get very strange results as mentioned before. I see packet 1, 2, 3, 27, 127. Then much later on ill see packet 9 appearing after packet 20000 for example. Some packets are missing characters and some are repeated several times. Quite often the client moans that the server forcibly closed the connection...
Nagy Vilmos answered my quick answers question and said
Nagy Vilmos wrote: If you are expecting high volume then the first thing to do is make sure your receiver takes the data off the inbound queue PDQ and puts it onto a call stack that you manage on a different thread.
A regular mistake is to process data directly from the TCP/IP pipe and expext the world to be sunny.
I really hope he sees this cause I'd like to pick his brain! But if not perhaps someone else can clarify...
By make sure your receiver takes the data off the inbound queue PDQ and puts it onto a call stack that you manage on a different thread I think he means to NOT process the data in the DataReceivedCallBack... Which makes sense I guess, cause while im processing a piece of data, 20 other pieces arrived and somewhere along the line something HAS to give in... can someone confirm this assumption?
He also mentions to put it in a call stack and process it on a different thread... So I'm assuming he means to just dump it in some variable to get it out of the read buffers as not to clog them and process it later... can someone confirm this assumption? An example would be nice, and I'm after efficiency, this server and the client code needs to be very scalable so please bare that in mind.
Another thing I was pondering was the read buffer sizes... How big do i make them? As far as i can see a small buffer would maybe need to make 5 or 6 callbacks(for arguments sake) for a single packet and callbacks are expensive so performance is lost. A Big buffer wont be fully utilized so alot of ram will be wasted. So the sweet spot would be to figure out how big your largest packet might be and make the read buffer that size...Once again I'm assuming all of this so if someone could confirm it that would rock.
I've googled high load tcp servers & clients in C# but I cant seem to find an article that explains it completely... Most of the time it just explain the .Net asynchronous programming model.
If someone could share some knowledge, experiences, tips, links to good articles or anything i would be really greatful. I really want to understand this and not just copy and paste some code.
Thanks for taking the time to read this, if you read this far you r0ck \m/
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
I am new to C# and VS2008. I am trying to create a report with a subreport. I have searched Google not to find a good example of how to create a report with a subreport. Does anybody have a good link for showing an example of this?
Thanks!
sk
|
|
|
|
|
I have a form (form1.cs) that sends a transaction record variable (TranRec) to a program (Transporter.cs) by calling it using Transporter.ConnectToDMV(TranRec);.
Transporter.cs does what it needs to do and returns to form1.cs for the user to enter and submit another transaction. Here's part of the Transporter.cs code.
Transporter.cs
public partial class Transporter
{
public static void ConnectToDMV(string TranRec)
{ rest of code processing TranRec ...
What I also need Transporter.cs to do is return a variable (logLU) back to form1.cs. For this I am using the following code;
Transporter.cs
Form1 aForm = new Form1();
aForm.SetValue(logLU);
form1.cs
public void SetValue(string luValue)
{
logLU = luValue;
// for testing purposes
MessageBox.Show("Here's the value of (form1)luValue: " + luValue);
MessageBox.Show("Here's the value of (form1)logLU: " + logLU);
}
I can see both variables in the messageboxes so I know logLU gets to form1.cs but then it returns to null when I need it in other parts of form1.cs. What am I missing??? Similar code works in other parts of my program but not here. BTW, I'm a newbie to C# and this is my first application.
Any advise will be very much apprecaited. 
|
|
|
|
|
Form1 aForm = new Form1();
aForm.SetValue(logLU);
Looks like you are creating a new Form1 everytime you set this value.
The new form will have the value, but any existing form will not.
Try making aForm a field instead of a local variable and assigning the value to the field version of aForm.
|
|
|
|
|
Thank you for your reply. (Remember newbie)
I think I tried that but had syntax issues. What would the code you recommend look like?
Thanx again!
|
|
|
|
|
At the top of your code define the form.
private Form1 aForm ;
Where you are going to open the form:
aForm = new Form1 ( ) ;
Do some stuff here...
When you want to return the value to the form:
aForm.SetValue ( logLU ) ;
When you are done with the form, dispose of it.
|
|
|
|
|
I end up with the same result. Although I had to do the following because the use of private generated an invlaid expression term 'private' error.
namespace DMV_Test_1
{
public partial class Transporter
{
public static void ConnectToDMV(string TranRec)
{
Form1 aForm;
Thanx for the suggestion.
|
|
|
|
|
You need to put it here, outside of any method. Then it will be available anywhere in the class.
namespace DMV_Test_1
{
public partial class Transporter
{
Form1 aForm;
public static void ConnectToDMV(string TranRec)
{
|
|
|
|
|
When I did that I got the following error on the two instances of aForm
An object reference is required for the non-static field, method, or property
aForm = new Form1();
aForm.SetValue(logLU);
Thanx for the suggestion.
|
|
|
|
|
Hi,
Change your method to return the value directly
public static void ConnectToDMV(string TranRec)
public static string ConnectToDMV(string TranRec)
Alan.
|
|
|
|
|
Tried that but it caused other problems in the code.
I fixed the problem by doing the following in form1.cs
namespace DMV_Access_App
{
public partial class Form1 : Form
{
public static string logLU;
public Form1()
{ Rest of form1.cs code ...
This took care of the problem. Seems so simple. Of course, being a newbie, I am not sure what ramifications there are but it does work. This is great forum!

|
|
|
|
|
As an example I have two categories in a property grid. One is read-only and the other is editable.
I use a timer to automatically update the properties in the read-only category, approximately every 100msec. However for the updated values in the read-only category to be displayed properly I have to do a PropertyGrid.Refresh() call. This moves the focus inside the property grid, so if I'm editing an editable property I lose my focus anytime the timer fires.
Is there a simple way to work around this?
|
|
|
|
|
Have you tried using the respective ActiveControl and SetFocus methods?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|