vb.net

How change column names randomly in gridview?

I am struggling to show different views of gridview with database values. Here is my requirement. Database Table: I need to show one drop downlist with three values 1,2,3. If user selects 3 i Need to show a grid like below Age,AnnualSales and Assortment are names which are coming dynamically from database. High,Medium and Core ...

Datareceived Serialport event stops raising after some seconds

Hi, I was hoping someone could help me out with this problem. I have a system (VB .NET) where I must read a person's weight (RS232 Sluice) and id (Fingerprint - 2 biometric reader, rs232) and compare it to a database. I have 3 serialports in my app, one for the sluice and the other 2 are to receive the id from the fingerprint readers, bo...

WPF: How to programmatically utilize the ErrorTemplate of an Control?

Hi, is there a way to programmatically set and remove the ErrorTemplate of an Control without the whole Validation mechanism? Basically, what I'd like to do, is to retrieve the ErrorTemplate of an Control at some point like this: ControlTemplate errTemplate = Validation.GetErrorTemplate(myTxtBx); and temporarily use it as it's Contro...

VB.NET: short cuts in code

Why is the following VB.NET code setting str to Nothing in my VS2005 IDE: If Trim(str = New StreamReader(OpenFile).ReadToEnd) <> "" Then Button2.Enabled = True TextBox1.Text = fname End If OpenFile is a Function that returns a FileStream EDIT: If the above line containing Trim is not correct, is there a way to achieve the int...

Looping through a file in VB.NET

I am writing a VB.NET program and I'm trying to accomplish the following: Read and loop through a text file line by line Show the event of the loop on a textbox or label until a button is pressed The loop will then stop on any number that happened to be at the loop event and When a button is pressed again the loop will continue. ...

.Net Thread Execution

I have written a thread which I've started using the start method but I'm not able to know when the thread has done executing the method and destroy the thread object. _ProgressThread = New Thread(AddressOf ExecProc) _ProgressThread.IsBackground = False _ProgressThread.Start() //the flow of execution should come here only after the thr...

How to write to a file in Unicode in Vb.Net

How should I modify the following Vb.Net code to write str to the file in unicode? Do I need to convert str to Unicode before writing to the file? Using sw As StreamWriter = New StreamWriter(fname) sw.Write(str) sw.Close() End Using ...

How to extract the img tag in Mail Body in VB.NET

I stored the mail contents(mail body) in database. I would like to extract the value of "src" attribute of the all image tag() from those mail contents. One or more image may be included in mail body. Please let me know how I have to acheive this in VB.NET? Thanks. ...

How to set the current row/record in a FormView-Control

Hello, I've used the Formview-Control first time now because i was hoping to benefit from its paging- and FormViewMode capabilities. What is the recommended way of setting the datasource and the current row/record? I have a Gridview on the Page and i want to change the Formview Data after the Grid's SelectedIndexChanged-Event occured, bu...

VB.net Enter Key

I was given the following pseudo code in order to get the form that has focus and only allow the form I want to be submitted: <script> var currentForm = document.forms[0];</script> <form ...><input onfocus="currentForm = this.form;"/></form> <form ...><input onfocus="currentForm = this.form;"/></form> function globalKeyPressed(event) ...

Can't get a List(Of <my class>) from a Dictionary in .NET?

I have a Dictionary with key of type UInteger and the value is List(Of Session) where the (Public) class Session contains a couple of variables and a constructor (Public Sub New(...)). Some of the variables in my Session class is: Private count As Integer Private StartDate As Date Private Values As List(Of Integer) and a couple of m...

Problems refreshing DataGridView after database update in VB.NET

Dim myQuery = "UPDATE table1 SET data= CONCAT (data,'" & vbCrLf & "[ " & Date.Now() & " ]" & " " & "[" & getCN() & "]" & " " & txtTelenotes.Text & "[ item1 ]" & "') WHERE id='" & txtID.Text & "'" myCommand.Connection = conn myCommand.CommandText = myQuery myAdapter.SelectCommand = myCommand Dim myData As MySqlDataReader myDa...

Stop unit tests from running

I would like to prevent all subsequent unit tests from running when certain conditions are met in a unit test. Is this possible in Visual Studio 2005? ...

Where to find a unique session ID at design time in .Net WinForms.

I've created a custom clipboard because it's not possible to make my whole class map serializable - which is a requirement for the windows clipboard. However, I need to distinguish between users who are using my clipboard through a unique id. Basically, I want to be able identify a person who is sat at one PC with one or more copies of ...

Why does C# execute Math.Sqrt() more slowly than VB.NET?

Background While running benchmark tests this morning, my colleagues and I discovered some strange things concerning performance of C# code vs. VB.NET code. We started out comparing C# vs. Delphi Prism calculating prime numbers, and found that Prism was about 30% faster. I figured CodeGear optimized code more when generating IL (the ex...

Messaging/Eventing Framework

I am looking for a messaging/eventing framework that will allow changes in one application to be subscribed to by other applications. My situation is I have an ASP.NET web application that allows users to perform CRUD operations. I also have multiple unknown applications that are used to synchronize data in our application with data in...

Getting the highest owner of a ToolStripDropDownItem

I'm currently working on a project in which at one point, the user may right click a button which brings up a contextMenuStrip. I am already able to find the owner accurately from that strip, and manipulate the button clicked as follows: Dim myItem As ToolStripMenuItem = CType(sender, ToolStripMenuItem) Dim cms As ContextMenuStrip = CTy...

VS 2010 Entity Repository Error

In my project I have it set up so that all the tables in the DB has the property "id" and then I have the entity objects inherit from the EntityBase class using a repository pattern. I then set the inheritance modifier for "id" property in the dbml file o/r designer to "overrides" Public MustInherit Class EntityBase MustOverride Pro...

Fill Combo-box via DataSource Using Values from Various Columns

Employee emp = new Employee(); comHandledBySQt.DataSource = emp.GetDataFromTable("1"); comHandledBySQt.DisplayMember = "FirstName"; The above code displays drop list of employees first names in a combo box. I want first name and last name to be displayed. How can i do it? I tried to include two colu...

How can I embed font in Visual Basic .Net application?

How can I embed font in Visual Basic .Net application? which should valid at every operating system. ...