|
Hi,
I have problem with reading from serial port.
Even though the port is connected and a thumb impression is given as input
my program couldnt read. It produces System.TimeOutexception in the line
of code where i read from port. I couldnt get any idea how to get rid
form that.
The following is my code.please guide me whati have to change to get
the output.
If serialPort.IsOpen Then
serialPort.Close()
End If
Try
With serialPort
.PortName = ComboBox1.Text
.BaudRate = 9600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
End With
serialPort.Open()
MsgBox("SELECTED PORT IS CONNECTED")
Dim bufferpic As Byte = CType(serialPort.ReadLine, Byte)
Dim MemstrmPic As New IO.MemoryStream(bufferpic)
Form1.PictureBox1.Image = Image.FromStream(MemstrmPic)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Thanks in advance
|
|
|
|
|
I can open an excel woorkbook and select the sheet that i want to work with. After i have populated the sheet with data from a web front end i wish to display all the new data in a table on a webpage. I know in what range the data is on the worksheet but im having trouble writing it to the table. Can anyone point me in a right direction please ??
some code ...
Excel._Worksheet objSheet;
Excel.Sheets objSheets;
public void PopulateTable() {
objSheets = (Microsoft.Office.Interop.Excel.Sheets)Session["ExcelSheets"];
objSheet = (_Worksheet)objSheets.get_Item(3); /// 3rd worksheet in the workbook
Range PrintQuoteRange = objSheet.get_Range("A1", "E68"); //data from cell A1:E1 to A68:E68
//// display rows, col and cells in a table
//// ?????
}
|
|
|
|
|
You're on the right way
With this range you may fill a multidimensional array and put it into a table.
Just use the .get_Value() method of the range object to retrieve this array.
<br />
string [,] mydata = PrintQuoteRange.get_Value(System.Type.Missing);<br />
Now you have the whole Data in the array. A simple for loop will do the rest
Tell me if you keep having trouble with getting the data into a table.
I had to do something similar just 2 weeks ago and found this article very useful:
How to automate Excel by using Visual C# to fill or to obtain data in a range by using arrays
ATTENTION: if you want to set a value of a cell to more than 911 characters, you will get a com exception. To work around this issue just use the querytable instead (have a look at the COM forumpost i made recently)
However, good luck with automating Excel
(Let me know if you are not able to kill the excel process properly - i just found a nice article to get rid of this too )
|
|
|
|
|
Thanks alot! It worked 100% .... but it looks a bit tacky.
I wanted it to look just like the format in Excel. So i went back to the drawing board for a new solution i want to share just incase someone else does it too.
I copied the Excel sheet area i wanted to use and pasted it right in a new webform design view and saved it as Template.aspx . It looks exactly like the format in the excel sheet.
Now the for cells i want to populate, i just name then with html tags. I then use a normal streamreader to read the Template.aspx file and use my session variables to change the tags to the values i want ...... and viola !
Thanks again for the table solution above, atleast it worked too.
|
|
|
|
|
hi .
I want to know how can get clicked link in IE or other browser with c#.net .(I want arived url of a link with click on it)
computer
|
|
|
|
|
Hi,
Actually what you want to do?
If i am not getting you wrong, you want to hyperlink to some URL on click?
<marquee>nishu
|
|
|
|
|
Hi,
I am looking for a way to change the default WindowClassName of a .NET form into a custom one.
The default WindowClassName is .NET is: (VS.NET 2005/.NET 2.0)
WindowsForms10.Window.8.app.0.3ce0bb8
The reason is that I want to use FindWindow with a my unique class name, and currently I am forced to find the window by window title (very fragile solution).
In C++ it was very easy, but in .NET it seems to be deeply hidden in Windows Forms.
Anyone has a good hack/solution to this problem?
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
Hi,
I'm not entirely sure if this is what you're asking, but I find individual open forms in my application using this code block:
foreach (Form frm in Application.OpenForms)
{
if (frm is MyFormClass)
{
return (MyFormClass)frm;
}
}
Where MyFormClass is the class of the form I want to find.
Hope that helps.
ChrisB
|
|
|
|
|
Hi Chris,
I am asking to change the Window Class name.
Your solution find open forms inside a .NET process.
I am trying to find a window from another process. So there is no access to Application.OpenForms.
The API to do this is called FindWindow, it is a Win32 API.
In Win32 each window has a ClassName which is a classifier and nothing to do with C++/C# classes.
Use the Spy++ with .NET windows (forms) and you will see that the Window ClassName is not unique (all .NET forms have the same ClassName).
I simply want to customize this ClassName for my forms.
Thanks anyway.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
Hi,
I'm looking for a way to specify the port numbers of a TCP connection via a TCPChannel object. I use the TCPChannel because
I need to receive callbacks in my client application:
<channel ref="tcp" port="8085" rejectRemoteRequests="false" exclusiveAddressUse="true" useIpAddress="false">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
<provider ref="secureHandshake" />
</serverProviders>
</channel>
The client instantiates the remote object in a common manner:
(ILogin) Activator.GetObject(typeof(LoginProvider), serverPath) // serverPath="....:7912"
Sysinternal TCPViewer tells me about the following established remoting endpoints:
Process Local Remote
Client.exe nb2h130c:8085 nbgh62091033:2147 // Connection#1 used for Callbacks
Client.exe nb2h130c:2176 nbgh62091033:7912 // Connection#2
Question:
Is there a way to specify the client port number (2176) of connection#2 and the number of the server port (2147)
Another strange behavior is, that these both connections will be periodically removed and new established with other port numbers, while client and server are still working without any problem.
In the internet, I only came across the information to set a fixed endpoint for COM+ applications.
Thanks for every reply
Thomas
|
|
|
|
|
I have made a deployment Setup Project in VS2005. I have two question reagrding it.
1. How can I check before the installation starts whether service pack is installed on the machine or not?
2. It generates a couple of files and folder. How can i package them into single self extracting executable file?
Any kind of help, suggestion or link would be highly appreciated.
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi.
How do I get the size of a COM object in C#?
Note that the COM objects I refer to support IPersistStream, but the MaxSize property isn't really supported by them.
Thanks alot.
Dirk
|
|
|
|
|
Hi,
I have a question on the article mentioned in the Subject.
I find it really helpfull but i have one Probleme.
I working with .Net 2005 an MS Outlook 2007.
To bring it to the point my Problem is that my PropertyPage is not Displayed in the Options Menü.
I don't understand that because he is perfoming the pages.Add(new OptPage(), "UsrPage") Method but nothing happens.
I used the Debug mode and I realised that the Caption Property is ignored (never performed)
[DispId(-518)]
public string Caption
{
get{return "DEMO";}
}
But I really don't know why because up to this point everything is performed in the same way.
So I would be really thankfull if someone can help me
Thx in advanced
SquallNaruto
If one eye is focused on the goal
then only one eye is left to find the way
|
|
|
|
|
To get work done a little faster with a datagridview I thought about assigning shortcut keys to value in one column. These shortcuts are configurable so that the user can change them. The code to find the right item for a given shortcut looks like this:
if (shortcutparts[0].ToLower() == "alt" && e.Alt &&<br />
shortcutparts[1].ToLower() == e.KeyCode.ToString())<br />
{<br />
itemsGridView.CurrentRow.Cells[1].Value = <br />
group.Name;<br />
}<br />
else if (shortcutparts[0].ToLower() == "ctrl" &&<br />
e.Control &&<br />
shortcutparts[1].ToLower() == e.KeyCode.ToString())<br />
{<br />
itemsGridView.CurrentRow.Cells[1].Value = group.Name;<br />
}
But there's a problem, that column is edited using a combobox, which doesn't accept the value I assigned to it, eventhough it does show the right value the first time. Anybody have an idea how I can get it to work?
WM.
What about weapons of mass-construction?
|
|
|
|
|
hello all,
I am new to C# and would like your help in this matter.
I know this is the syntax to declare a single dimensional arraylist in C#
ArrayList arraylist_name = new ArrayList().
Can anybody tell me as to how I can declare a 2 dimensional arraylist and access the same?
Thanks in advance.
Keshav V. Kamat
Systems Engineer
Siemens
India.
|
|
|
|
|
The best way to create that is to use the hashtable, although its a map and not a list you can still access the keys as if they were a list of values.
Hashtable table = new Hashtable();
To create a two dimensional arraylist you will have to write something like this:
ArrayList list1 = new ArrayList();
for(int x = 0; x < 10; x++) {
list1.Add(new ArrayList());
}
but this uses significant more memory and is not advisable if you only need the first lists index to access the second list. In that case you are better of with a hashtable that uses an Int32 value as key and ArrayList as value.
WM.
What about weapons of mass-construction?
|
|
|
|
|
thanks.
i will try that out.
Keshav V. Kamat
Systems Engineer
Siemens
India.
|
|
|
|
|
Ther are 2 things you could do.
1) If you know the size of the dimention you want to create, you could make an array of ArrayList.
ArrayList []list = new ArrayList[10];
for( int i = 0; i < 10; i++ )
{
list[i] = new ArrayList();
}
2) If you want a variable length (dont know the length) you could create an ArrayList of ArrayLists.
ArrayList list = new ArrayList();
ArrayList subList = new ArrayList();
list.Add(subList);
|
|
|
|
|
ArrayList list = new ArrayList();
ArrayList<string> list2 = new ArrayList<string>();
for the normal array its
String[] strings = new String[10];
WM.
What about weapons of mass-construction?
|
|
|
|
|
Thanks for the reply.
But I dont think you got my question right.
I dont want to declare 2 single-dimensional arrays separately.
I want to declare a 2-dimensional array like the one you do with the normal array like this
string[,] string_name=new string[10,10];
See if you know.
Keshav V. Kamat
Systems Engineer
Siemens
India.
|
|
|
|
|
Hmm, something is up with the post
I just saw two posts and now there's just one... Ah well, must be me sleeping again. See the answer posted earlier
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi
how can i add avi files to my application.
is three any control for this purpose
|
|
|
|
|
Hi,
in the directx library,
there exist a video library,
that you play, forward, reward, gather the current position,
total duration properties and methods like play pause stop.. etc..
just downlad the directx latest sdk...
but it is a little big size to download...
|
|
|
|
|
I want to set the datetime format in gridview control column.
|
|
|
|
|
HI
when i open a flderbrowse dialog box and select folder
"F:\Documents and Settings\Parshant\Local Settings\Application Data\Identities\{9A42BBED-20C1-4620-9381-F7ACFB5D1809}\Microsoft\Outlook Express"
then it throw a exception "invalid access to memory location"
But when select at another location it works perfect.
i written the code
DialogResult result = folderBrowserDialog.ShowDialog();
if(result==DialogResult.OK)
lbl_dbx_folder_info.Text=folderBrowserDialog.SelectedPath.ToString();
Parshant
|
|
|
|