brian_tsim's Q&A profile
Visual Basic Help with readline - really stuck !!
Hi - I have a small development app that (used to) talk to a servo on a com port, and get a status reply. I have somehow really fixed it (I tried to simplify the code) - but the symptoms are maddening, and I do not see what I did other than move a readline from a subroutine to be inline with the code. Here is what I have Public ServoCommName As String = "COM4" Public ServoCommSpeed As Integer = 9600 Public ServoCommdataOut As String Public ServoCommDataIn As String Public ServoCommParity As System.IO.Ports.Parity Public ServoCommDataBits As Integer Public ServoCommStopBits As System.IO.Ports.StopBits Public Com2 As SerialPort = My.Computer.Ports.OpenSerialPort(ServoCommName, ServoCommSpeed, IO.Ports.Parity.None, 8 ...Show All
Visual Basic Requist for permission of type system.data.sqlclient... error
I am just writing a simple VB application 'not.net' and before sqlconnection1.open() I got the following error: system.data.sqlclient.sqlclientpermission, systemdata Version = 1.0...,culture=neutral publickeytoken = ..... failed Please I need help on that issue or a go around. my app is a simple client server application that view/add data into VB form. thanks MSD ...Show All
SQL Server c# reusing parameters
I have a select statement which requires numerous parameters. here is a snippet. SqlCommand cmd = new SqlCommand("SELECT this from MyTable WHERE Answer1 = @Att 1AND Answer2 = @Att2 AND Answer3 = @Att3", connection) my parameters are added as follows. SqlParameter Att1 = new SqlParameter("@Att1", SqlDbType.VarChar, 50); Att1.Value = Attributes1; cmd.Parameters.Add(Att1); and so on... What I would like to do is be able to remove a parameter and re-run the SELECT statement if the number of entries retrieved is less than 5 (or any number) I tried just having a new Sql command like this. SqlCommand cmd2 = new SqlCommand("SELECT this from MyTable WHERE Answer1 = @Att 1AND Answer2 = @Att2, connection) and then did this.. ...Show All
Visual C++ "Go To Definition" in VS.2005 C++
I'm very disappointed how "Go To Definition" works in VS.2005 in comparison with VS.2003. 1. Problem with MFC. Why i'm not able to make "Go To Definition" to MFC source code It always goes to function declaration in .h file. In VS.2003 all works well. Open dlgcore.cpp from MFC sources. Navigate to line with INT_PTR CDialog::DoModal(). Right Click and "Go To Definition" - VS displays "Resolve Ambiguity" dialog with list contained only .h files. 2. I would like to make "Go To Definition" on intarface call. e.g. void Func(IDraw *pIFace) { pIFace->Draw(); } In VS.2003 "Go To Definition" on pIFace->Draw() displays list of all definitions in cpp fil ...Show All
.NET Development Named Pipes connection fails; but it's turned off!
We're running on a farm with a bunch of webservers and 3 database servers, spread over two locations. We're using P2P replication in SQL 2005. I'm creating a connection from an ASP.NET 2.0 website to SQL Server 2005. This is my connectionstring : Pooling=false;Database=whatever;Server=10.10.0.14;uid=myUser;pwd=myPassword; I'm using an ip address in the connectionstring because it's the load-balancer which will decide to what server I will actually connect. Pooling is off because I can't have it using the same connection over and over, I want it load balanced! :) The problem System.Data.SqlClient.SqlException : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure ma ...Show All
Visual Studio Invoke or BeginInvoke Error if from closed before entire report is generated
I have an app with a 400 page report. If the user closes the report viewer form (with Close X in upper right of form) before the report has generated all 400 pages, I get an error "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." You can tell how many pages have been generated by watching the upper left where it shows "Page 1 of X" where X is clicking off the pages generated in background. I'm assuming I need some error handling code but not sure what and where to put it! just To add on. i just tested this method. it does work. but dun put the time to wait to 0 Mayb 500 or -1.. Just a little info for those that may have this prob. ...Show All
Visual Studio Express Editions How Can I Drag Objects in the Form at Runtime
I have a simple program that use to modify the location of the objects on the form (e.g. Buttons, Textbox, Labels etc.) I really don't know how to drag it on a runtime, anybody can help me on this Tnx Public Class Form1 Dim MDown As Boolean Dim Formloc As Point Dim pbLoc As Point Dim CaptionHeight As Integer = System.Windows.Forms.SystemInformation.CaptionHeight Private Sub pb1_MouseDown( ByVal sender As Object , ByVal e As System.Windows.Forms.MouseEventArgs) Handles pb1.MouseDown 'pb1 is picture box If My .Computer.Mouse.ButtonsSwapped Then If e.Button <> Windows.Forms.MouseButtons.Right Then Exit ...Show All
SQL Server Iterating the rows of a script component
Hi There, Can someone please let me know what is the best way to iterate the output rows of a script component and stick in those ids in a where clause of a select query (to retrieve additional info from a database) Is this possible at all If not, what is the best way to deal with this situation Thanks a lot!! Jamie, Thanks a lot for your reply. I think I am almost there...So I have one one column in the recordset. Is this what I should do By using a for each loop container, with foreach ado enumerator I can get the id and store in a variable. Next can I have a dataflow task in the foreach loop... and in that dataflow task, can I access this id pass it as a variable to an sql command (in the ole db source). The sql ...Show All
Visual Basic AutoScroll problem of FlowLayoutPanel
Hi I find that if buttons are added to a FlowLayoutPanel, the AutoAcroll (via mouse wheel)works. But if the added controls are pictureBox, then the autoScroll does not work. Does anyone know why The code I used is: Dim panel As New FlowLayoutPanel Dim control As New PictureBox 'Button ' panel.Width = 300 panel.Height = 500 panel.Location = New Point(10, 10) panel.FlowDirection = FlowDirection.TopDown panel.AutoScroll = True panel.BackColor = Color.AliceBlue Me .Controls.Add(panel) control.Width = 200 control.Height = 1300 control.BackColor = Color.Blue panel.Controls.Add(control) Thanks. Thanks for your reply. In your code, t ...Show All
Visual Basic need to open a text file, rearrange contents, and save with a new filename
I have several hundred job files from an earlier CAD program that I need to rearrange so they can be read by a newer CAD program. Each program can read and write ascii files, but the formats are different. The files are split into sections with a keyword at the beginning of each section (like *lines* or *parts* etc. ) and each section needs a different kind of rearranging. Not only that, each section contains descriptions for many entities. So I have a group that has a line with one format, then several lines of another format, for each entity. Not only that, but some of the sections require location data from the middle of the input line to be inserted in a new line which is to be inserted into middle of the entity description. ...Show All
Visual Studio 2008 (Pre-release) Return XPS document from a web service
Hopefully this is a simple thing, but how can I return a XPS or FixedDocument via a Web Service Even something as simple as how to turn a XPS document to a byte() and the conversion from byte() to XPS Thanks. Steve Hi Sapaplanus, An XPS document is simply a ZIP file. Your best bet is to treat it as binary data, and send it across the wire. You can retrieve it the same way, and once you have the file, then open it up as an XPS Document. If what you want to do is keep everything in memory, then depending on your scenario it may not be possible. The architecture of an XPS document relies on links from one part in the zip to another. If you're creating content dynamically, you will generally need to s ...Show All
.NET Development Remoting application hanging
I am debugging an application that uses .net remoting. But when I debug, the application hangs after executing the line containing 'TextBox1.Text = m_RemoteObject....'. Also, when I debug, the debugger is not entering the DLLs. How does one debug a DLL Pls. help and thanks in advance. Code: Webform1.aspx.cs private void RadioButtonList1_SelectedIndexChanged( object sender, System.EventArgs e) { //FunctionSelected( RadioButtonList1.SelectedIndex ); } private void FunctionSelected( int i) { TcpChannel m_TcpChan = new TcpChannel(); switch (i) { case 0: IAuthenticateUserService m_RemoteObject = (IAuthenticateUserService) Activator.GetObject( typeof (IAuthenticateUserService), ...Show All
SQL Server calculating age using sql server function
Hi ya, I have a table which will be having DOB and I want to calculate the current age of persons, i want to save it into currentage as default. I have searched over the interent and find some solutions but in my database the DOB is stored as = 'dd/mm/yyyy' and none of the solutions work on this. Any ideas First, create this user defined function. ALTER function [dbo].[fn_GetAge] ( @in_DOB AS datetime , @now as datetime ) returns int as begin DECLARE @age int IF cast ( datepart ( m , @now ) as int ) > cast ( datepart ( m , @in_DOB ) as int ) SET @age = cast ( datediff ( yyyy , @in_DOB , @now ) as int ) else IF cast ( datepart ( m , @now ) a ...Show All
Windows Forms how to generate dynamic checkbox?
i need to list items from a table into checkbox. and the number of item is unknown. i need to bind ID and DESCRIPTION into checkbox. the ID is not to be seen by user, but i need it to perform some tasks. please help me on this. any help woule be appreciated. thanks. Use a ListBox to contain the CheckBoxes, set the DataRow of the dataTable to be the items of the ListBox, and OwnerDraw the ListBox's items to let them only display the descrptions. See my sample below: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Sample3 { public parti ...Show All
Visual Studio Express Editions object reference?
i typed this: (dno if it works yet tho, was just trying it out) object Timo = Database1DataSet .Tables[1].Rows[1].ItemArray[2]; in a buttonclick event but there is an error that says: An object reference is required for the nonstatic field, method, or property Test.Database1DataSet.Tables.get what is an object reference thx in advance What code you have to type depends on what do you actually want to do... this is pretty obvious. However, by how your code looks, it seems that you are just experimenting or trying out the data access features of the language... Is there actual data in the database you are using If you try to read the rows from a table that has no rows, it will obviously fai ...Show All
