vb.net

Types comparison in VB.NET

How i can compare type data type in VB.NET? My code: Private Function Equal(ByVal parameter As String, ByVal paramenterName As String, ByVal dataType As Type) As String If dataType = String Then return 1; End If End Function Any ideas? ...

Vb.net - Search Excel file for values

Hi! I have a form with a couple of combo boxes. The first combobox adds items based on each row in an excel sheet. Public Sub FetchExcelValues(ByVal ControlType As String, ByVal control As Object, ByVal xlApp As Object, ByVal xlWorkBook As Object, ByVal xlWorkSheet As Object, ByVal column As String, ByVal row As Integer) Dim iTelle...

How to determine which DataRow is bound to a DataGridViewRow

Hi all. When I use a DataTable as a DataGridView's DataSource, I often have to find which row(s) a user has selected and read specific values from the DataTable (not the DataGridView) I wanted to know if there is any reliable way of determining which DataRow a DataGridViewRow is bound to especially when the user has sorted the DataGrid...

How do I perform an assignment operation in a lambda expression

I have a list of items and wish to set one of their properties to a certain value: applist.ForEach(Function(x) x.PrePaidTypeID = CInt(DBEnums.PrePaidType.NoPrepay)) ...but we think this just does a boolean comparison. Is there a way to force VB to assign the integer value rather than compare it? ...

Application.ProductVersion always returns 1.0.0.0

On the publish tab of My Project the correct current version is there, 1.1.0.0 and in Programs and Features under Control Panel it shows 1.1.0.0 but when I reference Application.ProductVersion I get 1.0.0.0. What am I doing wrong or what am I missing here? Thanks. ...

How to terminate code that takes long in vb.net?

How to terminate function/code (not entire page) when it takes some time, for example, more than 1 sec? If Code > 1 Sec Then Terminate the code.... I found the command "Server.ScriptTimeou", but it stops the entire page instead of one command. ...

Reflection: optimize performance

Hello, i want to know if i could optimize the reflection part of my app. Background information: the vb.net windows application checks if database records apply on different rules. So i created an Interface iRule and (so far) 54 rules-classes that are implementing it. They all belong to the same project(Rule.dll). Because people shou...

How to see if a type implements an interface in VB.Net?

I need to know if a Type implements an interface. Dim asmRule As System.Reflection.Assembly = System.Reflection.Assembly.LoadFrom(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Rule.dll")) For Each typeAsm As System.Type In asmRule.GetTypes If TypeOf typeAsm Is Rule.IRule Then 'that does always return fa...

Coding standards for VB.NET

Possible Duplicate: C# Coding standard / Best practices What VB.NET or C# coding standards are you using for your .NET applications? I was looking at hungarian notation and I don't think it is a good idea for a .NET application. Any suggestions? Thanks ...

Row doesnot exists in DB- Exception

We have a dataset dsActualCost which fetches query value: MonthName in one column and Cost in another. We have a code to display data in table format. For MonthIndex = 0 To dsMonth.Tables(0).Rows.Count - 1 Dim tdMonthlycost As New TableCell If dsActualCost.Tables(0).Rows.Count > 0 Then If IsDBNull(dsActualCost.Tables(0).Rows...

Query Active Directory from ASP.NET and bind result to List View

I managed to do ASP.NET authentication work wih AD. Now, I want to query an OU in AD and display the result either ListView or GridView in ASP.NET page. Here's the Domain Controller: dc.itlab.edu The OU: UsersStudents In the organizational unit (OU) UsersStudents there are following columns: First Name, Last Name, Pre-Window...

id.style.display not working

Not sure why this isn't working. There is no js error, but it just doesn't set the display property to "block". If I remove the inner most if statement, the display property for the div control is changed when the last radio button is selected from the group. .aspx file <asp:RadioButtonList ID="rblMarital" RepeatDirection="Horizontal" ...

Registry.CurrentUser.OpenSubKey returns Nothing when called from a Service

In a VB.NET application that runs as a service, I am getting a value of "Nothing" returned when I use Registry.CurrentUser.OpenSubKey(). The same code executes correctly when the application runs in desktop mode. I am not much on VB.NET and unfortunately, this is not my code. Code: Dim regURL As String = "Software\MyCompany\" + _ ...

ASP.Net String Split not working

Here's my code Dim RefsUpdate As String() = Session("Refs").Split("-"C) Dim PaymentsPassedUpdate As String() = Session("PaymentsPassed").Split("-"C) Dim x as Integer For x = 1 to RefsUpdate.Length - 1 Dim LogData2 As sterm.markdata = New sterm.markdata() Dim queryUpdatePaymentFlags as String = ("UPDATE OPENQUERY (db,'SELECT * FROM...

continuous http stream

My app currently sends GET httpwberequests and parses the content after reading the response stream for each request and the repeats this process over and over. I need to implement a continuous http stream which uses the same GET request but the connection stays open, from what I understand. how would I change my existing code to do this...

Preventing SQL Injection in ASP.Net VB.Net

I have this code UPDATE OPENQUERY (db,'SELECT * FROM table WHERE ref = ''"+ Ref +"'' AND bookno = ''"+ Session("number") +"'' ') How would I prevent SQL Injections on this? Thanks Jamie UPDATE Here's what i'm trying SqlCommand cmd = new SqlCommand("Select * from Table where ref=@ref", con); cmd.Parameters.AddWithValue("@ref", 3...

Dynamically changing a table cell background color in aspx vb.net

I have the following table row on my .aspx page. Initial Requirements:     <ItemTemplate> <td valign="bottom" id="ReqStatus" runat="server" style="background-color: Gray"> <%#ReqStatus(CType(CType(Container.DataItem, System.Data.DataRowView).Row, DataSet1.DataTable1Row))%> ...

SmtpMail - Change the "From Address" to Name

I use SmtpMail for users to forward site content. The user fills out a form which includes first name and email. The email sent has the full email address as the "From address" in the recipients inbox (they see From: [email protected] while I want them to see From: Joe). How can I format the "From address" to be the users inputted first n...

Creating directory in FTP

Hello, i am using the following piece of code to create a directory. The problem is that i do not get an error, but i do not also find the directory i justt created. So, what am i doing wrong here? Should i take a break? Public Function CreateDirectory(ByVal Dir As String) As Boolean Dim myftprequest As Net.FtpWebRequest = CTy...

System.Data.SqlTypes and NULL

If I have a variable, X, of type SqlDecimal, that was instantiated without providing a decimal value parameter to the constructor, then the .IsNull property is True: Dim X As New SqlDecimal '.Value = Null If I have a Stored Procedure that acepts a single parameter, @SqlDecimalParameter, of type Decimal, the value of this this paramete...