Hey guys, so I've come across something which is perhaps a flaw in the Extension method .CopyToDataTable.
This method is used by Importing (in VB.NET) System.Data.DataTableExtensions and then calling the method against an IEnumerable. You would do this if you want to filter a Datatable using LINQ, and then restore the DataTable at the e...
My co-worker said that in a previous interview, he learned that foreach is faster in VB.Net than c#'s foreach. He was told that this was because both have different CLR implementation.
Coming from a C++ perspective, I'm curious on why this is and I was told that I need to read up on CLR first. Googling foreach and CLR doesn't help me un...
I used a OCX which is designed to control Video.
If I use OCX in the vb.net , and send command to get a snapshot picture,it would return a bytes array,then I turn it to be a stream then turn it to be a Image , then It would show it correctly.
but when I embbed OCX in webpage, It still work will,but I can`t catch the snapshot picture,
if...
I want to resize the images inside the picturebox.
I'd made this already
Private img As Bitmap
rec = New Rectangle(0, 0, 520, 470)
Private Sub PicFace_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles PicFace.Paint
PicFace.SizeMode = PictureBoxSizeMode.Zoom
Draw(e.Graphics, rec.Width, rec.Height)
'Draw(e.Gr...
Hi there,
Processing an XML file with LINQ to add records into a table in a SQL Server database via a data context. As we are adding records we need to assign the parents in various other tables. Most of the time we can find the existing parent and use it but sometimes we will need to create a new parent.
Thought we could do this like...
Ok, so I'm new to VB.NET and trying to write a program that prompts the user for a server name and then restarts the IIS on that machine.
Problem 1) namespace System.ServiceProcess is not being recognized.
Problem 2) need help with code, passing servername into sub.
Imports System
Imports System.ServiceProcess
Imports System.IO
Import...
I wrote this - very simple - function, and then wondered does VB have some pre-built functionality to do this, but couldn't find anything specific.
Private Shared Function MakeArray(Of T)(ByVal ParamArray args() As T) As T()
Return args
End Function
Not so much to be used like
Dim someNames() as string = MakeArray("Hans", "Luke",...
UPDATE: Apologies on lack of clarity I realise I could iterate over the controls collection, was just looking for a better/more efficient method.
I am trying to dynamically add some css and js elements into an ASP.Net page at runtime, but because this code is used in mutliple controls I need to ensure that the relevant links are only in...
I have a constructor that looks like this:
Public Sub New()
MyBase.New()
ws.Url = My.Settings.WebServiceURL
End Sub
(ws is private)
Is there any point in unit testing this?
The class did not previously have this constructor.
...
The question pretty much says it all, I've tried setting the backcolour to transparent in the properties section, but it didnt seem to work. I have a picture behind the groupbox that I need to show through it. Is there a specific way of doing this?
Thanks
...
I have a login link that fires a javascript function that calls a logout page. This is what the logout page consists of:
If Response.Cookies.Count > 0 Then
Response.Cookies("aLog").Value = Nothing
Response.Cookies.Clear()
End If
Originally I just had cookies.clear in there, but that wasn't working.
Here is the javascript th...
How do i do this in wpf
VB.NET
Private Sub FrmSettings_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
e.Cancel = (e.CloseReason = Forms.CloseReason.UserClosing)
Me.Hide()
End Sub
c#
private void FrmSettings_FormClosing(object sender, ...
I want to write some stats to a text file every time a person loads a page. But every once in awhile I am getting at 'Could Not Open File, Already in use' type of error. I can not 100% replicate this error it is very erratic. My code is
Public Sub WriteStats(ByVal ad_id As Integer)
Dim ad_date As String = Now.Year & Now.Month
...
Hi there,
I'm trying to run some java script just before a page redirect but it fails to run.
When I comment out the Response.Redirect all works fine but this goes against the particular requirements. Any ideas on how to implement this functionality?
Dim strscript As String = "<script>alert('hello');</script>"
If Not Cl...
I think in C# you can create in-line RouteValueDictionary instances like this:
<%=Html.RouteLink(Model.Name, "SomeRoute", new { id = Model.Id }) %>
What's the equivalent in Visual Basic?
This works, but is quite wordy:
<%
Dim d As New RouteValueDictionary()
d.Add("id", Model.Id)
%>
<%=Html.RouteLink(Model.Name, "SomeRoute",...
hi all. Today is 3/12/2009 and based on today's date. I want to get the start date of this year and that will be 1/1/2009. Does anyone know if there is a way to do this? The reason for this is i want to get the DateDiff of today's date against the start date of today's date's year.
Jack
...
Hi,
I was just handed a VB.NET prototyping effort, and I'm not very experienced with VB.NET.
I had to create a stored procedure which returns a self-referential table in order. Once, I completed that I wanted to get a DataGridView to show the results.
Previously, my team has been doing a lot of this via the GUI designer of VB.NET so I...
I am trying to create a DisplayAverage sub procedure that accepts 3 integer numbers as parameters. This procedure should find the average of these 3 numbers and display the numbers along with their average in the list box. I know im doing something wrong here I just cant figure out what. Thanks in advanced.
Private Sub btnAverage_Click(...
How can i retrieve NULL Field [ Date Out ]in sql 2005 database to a Grid View in ASP.Net.
I need this field to be edited by the user.
...
I'm creating a program to generate PDF files in VB.Net.
Everything is working fine except that the image is being displayed with a blue background while the image provided doesn't have any.
Following are the lines of code being used:
sColor = IIf(mvarEncodeASCII85, ToASCII85(ImgColor),
(System.Text.Encoding.GetEncoding(1252).GetSt...