vb.net

FTP Downloading a file while its upload is in progress

Hi All, I have a windows service (VB.NET) which downloads files from a server after a specific interval. What happens if it try to download a file when its upload is in progress? If it creates some problem, how to cope with this situation? Thanks, Imran ...

Detect SQL Injection

I came to a company that already has a fully grown project... but coders that worked here before me didn't follow conventions and didn't use parametrized SQL queries... as a result there is over 1000 places in a very huge project that can possibly be vulnerable to SQL injection... I need to find a solution that will automatically detec...

vb.net LINQ to DataTable error - End of statement expected

If txtSearchString.Text.Trim <> "" Then Dim searchString As String = txtSearchString.Text.Trim Dim results As EnumerableRowCollection(Of DataRow) = From PO In FilterPurchaseOrders().AsEnumerable() _ Where PO("Title") Like searchString Or PO("PONumber") Like searchString _ Or PO(...

BSOD while playing a sound resource

I have a VB.NET application that crashes on a client's computer with a BSOD error... KERNEL_DATA_INPAGE_ERROR. This error occurs at a point where my program does two things: Locks the computer Plays a sound in BackgroundLoop mode For locking the work station, I am just using this: <DllImport("user32")> _ Public Shared Sub LockWorkS...

Alternate a 'due' date based on two other dates in VB.Net?

I would like to get a 'due' or predicted inspection date based on alternating with another date? How would I go about this ? Thankyou! Enum EnumSiteInspectionFrequency As Integer ' alternating with WRA None = 0 ' None Yearly = 12 '12 months SecondYearly = 24 '24 months End Enum Sub Calculate() Di...

Index was outside the bounds of the array.

Im getting this error message randomly: Index was outside the bounds of the array. And it points to this line: Dim placename As String = RichTextBox1.Lines(0) ...

Can disabling a control cause a radio buttons value to change?

I have a For Each loop going through the controls in a panel disabling them. When the loop reaches one certain grid control and disables it the CheckedChanged event fires for the next control in the loop which is a radio button. The call stack is as follows: System.Windows.Forms.dll!System.Windows.Forms.RadioButton.OnCheckedChanged(Sys...

Why doesn't BindingList(Of T) have AddRange Member?

I think the title pretty much captures my question, but a little bit of background follows: When a form I have loads it adds a couple of thousand (30k odd) objects to a binding list. When my application loads the first time it takes multiple seconds (around 10 or so from memory) for it to loop through the list of objects and add it to t...

Is the .Net framework required for even a single line of VB.Net?

I wrote very simple code to send emails. I wish that end users who do not have .Net Framework installed, could also install this application without installing .Net Framework. Is it possible? ...

Custom shape object in MS Office

I want to create some custom shapes for MS Office which we can use in house. For example I want to create a shape named “carton box” which have three – four default places where user can add some text. It is same as other shapes or I would say just like shapes (line, flowchart, arrow etc) in MS office 2007. Is there any way to create a...

Getting 10 most recent files only

Hi, i am using following code to search my computer for files with certian extensions. I currenty searching for .eml files. This code lists all files found. I need to enter 10 most current files' path to my list box. How can I do it? Thanks Dim DriveLetter As String = "c:\" '" Dim Ext As String = ".eml" Private Sub Button1_Click(By...

Adding entry to Registry for startup of application

Hi, I took the following method to make a registry key in my setup project. When I run setup, it says Could not write value Run to the key. Verify that you have the sufficient access to that key, or contact your support personnel. " Please advise how to fix this. Thanks Below I have copied the code that I took from the forum Afte...

Sorting xml with either repater/xml functions in vb.net

Hi! I need to sort and choose only the last 5 inputs to my xml, Ill give you an idea of how my xml looks like. <News> <Article> <Headline>First</Headline> <Content>First</Content> <ID>1</ID> </Article> <Article> <Headline>Second</Headline> <Content>Second</Content> <ID>2</ID> </Article> </News> And im ...

.net 2010 VB.NET Xml Winforms - Persisting MDI child position and state

I know something similar has already been asked, but here's my problem. In a MDI WinForm I want to save each child window position and state, per application user, that is different by the logged in Windows user. My application has its own users; so I won't use the user settings like my.Settings... etc. One option is to read/write dire...

How do I make a system call and reload a file in a Visual Studio 2010 macro?

As you read this, though I have pretty good experience in C++ and Java, please keep in mind that I am a complete beginner when it comes to VB. :) Here is one idea of what I want to do: Option Strict Off Option Explicit Off Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports EnvDTE90a Imports EnvDTE100 Imports Syste...

.net newbie question databinding if

Hello , how could i write this in the aspx page : <%# If (Eval("discount") <> "") Then%><div style="width:900px; float:left;"><strong>Discount%:</strong> <asp:Label ID="discountLabel" runat="server" Text='<%# Eval("discount") %>' /></div><%end if %> Now i get the following error: Databinding methods such as Eval(), XPath(), and Bin...

Starting a process in the current command window in .NET

I have this in a VB.NET console application: Dim p As ProcessStartInfo p = New ProcessStartInfo(Environment.CurrentDirectory & "\bin\javac.exe",ClassName & ".java") Dim ps As Process = Process.Start(p) This does run the java compiler on the file, but it does so in a new window. I want the output from javac to appear in the same conso...

Uri.IsWellFormedUriString allows http://http://<url>

This seems strange to me but I am sure there is an explanation If I use Uri.IsWellFormedUriString passing in "http://http://www.google.com" it returns true, I can only assume that this URI conforms to some RFC specification and is valid. Most of my other tests indicate this method works in the manner in which I expect other than this ...

Passing null to an optional parameter with default value

I think this is a pretty basic question, but I just want to clarify. If I have a variable with a null value, and pass it as a parameter that is optional, will the parameter get the null value, or the default value? dim str As String = "foo" dim obj As Object //call 1 Request(str, str) //call 2 Request(str) //call 3 Request(str, obj) ...

VB.net web browser question

making a web browser on vb.net is depending on your internet explorer. How can I customize it so it will depend on mozilla. Please any suggestions or recommendations. Thanks. ...