vb.net

LINQ Replace DBNull with Blank String

In this example, an error is raised if either row.FirstName or row.LastName are NULL. How do I rewrite the Select clause, to convert a DBNull value to a blank string ""? Dim query = From row As myDataSet.myDataRow in myDataSet.Tables("MyData") _ Select row.FirstName, row.LastName NOTE: Since the DataSet is strongly-typed....

How to populate GridView.DataKeyNames, constructing array from within a loop? (String array syntax question)

I have to set GridView.DataKeyNames (This is really a question about the syntax for a string array, in VB.Net.) I am discovering the PrimaryKey columns names from within a loop, ie: For Each fld As IEntityField In Me.llbDataSource.EntityCollection(0).PrimaryKeyFields 'fld.Name ' this is where the column name is stored, so I have to...

Operand type clash: nvarchar is incompatible with image

I'm using a SQL Server 2008 stored procedure to create a new record with this syntax: cmd.Parameters.Add("@photo", DBNull.Value) cmd.ExecuteNonQuery() but the result is a: Operand type clash: nvarchar is incompatible with image Photo is not the only parameter but is the only image one, I am not passing a nvarchar but a null v...

Update Table, Where Column Name is selected dynamically - DropDown.SelectedValue, C#, VB.NET

Hi, I want to Update Column of a Table where ColumnName will be DropDown.SelectedValue. Example: A set of RECORDS will be displayed from a Customer Table where CUstNo ='1234' and City= 'Chicago' and Grade ='B' Once displayed I want to Update the grade to 'A' of all those customers from the above criteria. In My case I have like 100...

Quick and easy way to remove "dead" (commented out) code

I'm working with an inherited code base which contains thousands of lines of commented out code. I know the previous coder meant to save all his hard work for posterity rather than simply deleting it but: I will never read it and it just gets in the way. One problem example is that when I perform text searches for certain code segments I...

COMException (0x80010108 - RPC_E_DISCONNECTED) When Closing Excel.Workbook

When I run the following code, I get the exception below: ''# NOTE: ExcelApp is a Private main form variable Dim ReportBooks As Excel.Workbooks = ExcelApp.Workbooks Dim ReportBook As Excel.Workbook = ReportBooks.Open(localFilename) Dim ReportSheet As Excel.Worksheet = ReportBook.Sheets("Report") ''# Retreive data from sheet ReleaseCOM...

creating table at runtime in vb.net, image control doesnt have imageurl proerty

i am creating a table in vb.net code (htmltable) with htmltablerows and htmltablecell. I gave on image control but thatr control cant have the .imageurl property, which i need cause i have a handler image.ashx which brings image from the database. heres' the code - TD = New HtmlTableCell Dim img As New HtmlImage() img.ID = "image_" & rd...

Trying to list data in ms sql using vb.net

Below is the code that I'm using in ms access to list the data according to what is selected in combobox and what is input in textbox. My problem is there no commandbuilder in ms sql like in ms access, because it fails when I try: dim mscombuilder as new sqlcommandbuilder Here is the code: ''#list school If ComboBox1.SelectedItem =...

open webpage (or snapshot of webpage) into another webpage though vb.net

i have an aspx page with vb.net back end. in that page i get names and url's from the database depending on different conditions. My requirement is that when i get the url, the code should then use that url and have that webpage in a small preview form on my existing aspx page. so basically i have a table as follows - Name URL ...

Function to convert "camel case" type text to text with spaces in between? ie: HelloWorld --> Hello World

Anyone know of a nice efficient function that could convert, for example: HelloWorld --> Hello World helloWorld --> Hello World Hello_World --> Hello World hello_World --> Hello World It would be nice to be able to handle all these situations. Preferably in in VB.Net, or C#. ...

User Control and Binding

I've created a custom control which consists of two radio buttons with their appearance set to "Button". This control is meant to act like two toggle buttons with an "On" toggle button and an "Off" toggle button. I have a public boolean property "isAOn" which is used to set the state of both buttons and I want to be able to bind this pro...

image in combobox vb.net

how to put user image in combobox when Im going to dropdown for example in combobox [image+User1] [image+User2] [image+USer3] tnx. ...

Start Debugging is disabled in vb.net solution File

I hav I hav a vb.net project in which the start debugging is disabled so can u help me ...

How to refresh a page from another page in asp.net?

How to refresh a page from another page in asp.net?I have one page called Common.aspx.Once i click some button another page(Company.aspx)should refresh.How It possible? If Not ClientScript.IsStartupScriptRegistered("ReloadPage") Then ScriptManager.RegisterStartupScript(?,Me.GetType(), "ReloadPage", "ReloadPage();", True) End...

add c# user control to existing asp.net vb.net project

Hello, I've got an existing asp.net project written in vb.net. Another person has written a user control in c#. Could you please let me know the steps for adding that C# user control to the vb.net app? I've tried copying them to the folder and using "Add existing item", however it doesn't compile the code behind at all. Thanks, Fidel...

How can I show Crystal Report from VB.NET 2008 Project without showing the authentication box?

I have a Sub like this: Public Sub ReportViewer(ByVal ReportName As String, ByVal SQLText As String) Dim strReportPath As String = System.AppDomain.CurrentDomain.BaseDirectory() & "Report\" & ReportName & ".rpt" If Not IO.File.Exists(strReportPath) Then MsgBox("Unable to locate report file", MsgBoxStyle.OkOnly + ...

How to set head tags in a function in app_code?

The below function has to be put within my common functions file in app_code folder. how do I do it? It gives error like this: Reference to a non-shared member requires an object reference Public Sub setHeadTags(ByVal title As String, ByVal description As String, ByVal keywords As String) Dim metaDescription As HtmlMeta = DirectCas...

problem of complex databinding in vb.net

i am creating a form in vb.net in which i have combo boxes and textboxes..and i would like to bound the currently selected value from the combo box with the textboxes at run time.the text boxes should display the text from the database for the currenlty selected value in the combobox ..can anybody help me please??? ...

For Each Loop LINQ Insert giving me Cannot add an entity that already exists.

I have the following code, that in my head should create a new row in a table: Dim fin As Boolean Dim db2 As New ChecklistModeldbmlDataContext For Each a In bServers If collection("fin" & a.ServerName) = "true, false" Or collection("fin" & a.ServerName) = "true,false" Then fin = True Else fin = False End If b...

Using evidence, security policy and permissions to prevent assembly from loading on web server

Assume a .NET class library code that, for example, writes to the Windows registry. Then this code has problem to run over internet, because default Internet policy does not give access to write to the registry. By adding a RequestMinimum statement in the assembly we can specify that the code requires permission to write to write to the...