vb.net

Exception was thrown when adding new rows to datatable

listA is list of integer dtListB is DataTable I'm checking that if StudentId of ListA doesn't exist in dtListB, then add it to the dtListB. Dim stidListA, stIdListB As Integer For Each la In listA stidListA = la.StudentId For n = 0 To dtListB.Rows.Count - 1 Step 1 stIdListB = dtListB.Rows(n)...

Want to set the value of a textbox based on the value of a 2nd text box

I have a textbox which can be left blank or contain a date. If the textbox has a date I want the 2nd textbox's value to be set to the value of a session variable. I need this to happen before the update sql is performed on postback. This is the code I have. But the textbox is coming back as nothing. Whether it has a value in it or n...

Visual Studio Refactor for vb.net

Hi. why visual Studio Does not have Refactor tool for vb.net by default ? but it has this tool for c#. for example extract method and etc. thanks all. ...

How can I pass additional parameters to predicate?

My issue is to Find exact one Calendar object from a List Of(Calendar) by passing a particular date. I got to know about the predicate but not sure about passing parameter to it. colorcode is List Of (Calendar) and calendar class has a property called DtmDate with which I want to compare and return the desired object. Dim a As Calenda...

this action exceed the number of page breaks you can manually add to a worksheet. a worksheet can contains up to 1026 horizontal page breaks

Hi, I developed a excel add ins using VB.NET 2005. and in this when i adding page break below error is occurred :- This action exceed the number of page breaks you can manually add to a worksheet. a worksheet can contains up to 1026 horizontal page breaks So can any one suggest how i insert more than 1026 page break or any other s...

Problem in saving image to database from picturebox. VB.Net 2008. Framework 3.5.

Hi there, I have a form containing a listbox showing a list of image names. It's bound to the database table. When an image name is clicked it shows the image and imagename in a picturebox and textbox respectively. When no image is selected in the listbox, a new record can be inserted by browsing a new image in the picturebox by an ...

How does indirection introduced by interfaces and factories affect performance?

Hi all, I would like to improve testability of some legacy code. To achieve this, I am introducing interfaces for existing classes (and have existing classes implement those) and factories that create an instance of a test object or an object of the original class, depending on some configuration setting. I can foresee some internal fe...

Can we have member variables in Interface?

I read somewhere that interfaces can have member variables. Static final constants only, can use them without qualification in classes that implement the interface. On the other paw, these unqualified names pollute the namespace. You can use them and it is not obvious where they are coming from since the qualification i...

Performance problems with displaying a WinForm dialog from WPF application.

I am currently developing a WPF application that will utilize existing WinForm dialogs. I'm experiencing a long lag between the time I call ShowDialog() on a WinForm to the time it is displayed. Even when reusing WinForm dialog objects the lag time is nearly as bad on the second hit. Meaning that the problem isn’t in the constructor. D...

Email sending problem

Hi, I am using following code to send emails. It works from a computer where I have installed Windows XP but does not work from a computer where there is Windows Vista. Could anybody explain what I should do? Try Dim oSvr As New Net.Mail.SmtpClient("mail.server.com") Dim oMail As New Net.Mail.MailMessage oSvr.Credentials =...

ASP.NET - Fill/update row in gridview when a textbox loose focus

Hello. I have the following gridview that is inside an updatepanel: <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="ButtonAdd" runat="server" OnClick="ButtonAdd_Click" Text="Novo Artigo" /> <asp:GridView ID="Dados" runat="server" AutoGenerateColumns="False" CssClass="Grid"> ...

VB.NET HttpWebRequest POST

Hey whhat's up. I've been looking at some example source codes but I can't quite figure it out. I'd like to send a POST request to login to a website with my account. For an example, how would I login to this website using HttpWebRequest.. http://z4.invisionfree.com/cotec/index.php? It's for an application I'm building for my clan wher...

VB.NET: Get class name of a instance

Is there a way to get the instance's class name with VB.NET? ...

VB.NET HttpWebRequest POST

I was given a class that sends a post httpwebrequest to a website and here is the link.. http://joel.net/code/easyhttp.aspx I was wondering if somebody could give me an example of how to use it for this website z4.invisionfree.com/cotec/index.php? I'm making an application where a user must log in with their forum account to use it. ...

VB.NET: Who called the shared method?

Hi, I have a parent class (Foo) with shared methods. It is MustInherit. Bar and Baz classes inherits from Foo. I will do something like that: Dim baz as New Baz() Dim bar as New Bar() baz.sharedMethod() bar.sharedMethod() Within of Foo's sharedMethod(), I need to know who (class name) called it. So, using the above example, it would ...

When calling unmanaged code from VB.NET, is it more reliable to use DECLARE LIB or DllImportAttribute?

We have a VB.NET program that needs to periodically call a function in an external, unmanaged DLL to communicate with our legacy application. We are having a problem with the application (seemingly) randomly not being able to find the DLL with the unmanaged code. Currently we use DECLARE FUNCTION blah LIB for the unmanaged code. Would...

WPF iterate through items in a listview

I have a ListView with a CheckBox as one of the columns, bound to a boolean property of a custom object. I'm trying to figure out how to iterate through the items in the ListView and check all the checkboxes. What I have so far is below: XAML: <ListView x:Name="MyListView" DockPanel.Dock="Top" Height="275" IsSynchronizedWithCurrentIt...

Does .Net's Assembly class store variables?

Ok so here's the story. I have an array of Assemblies which are initiated by [Assembly].LoadFrom() that load a number of DLL's. Upon initialising, a method called InitMain (from the DLL!) is called, which sets a number of variables outside of this method, like here: Public Class Example Dim C As Integer = 0 Public Sub InitMain...

LINQ / VB.NET select distinct from dataset

Hi, I have a single columned datatable inside a single tabled dataset. I just want to convert this dataset to distinct rows. Here is my code, it gives compile error '.' expected. What am I doing wrong? (I tried adding the ., still same error). I know this is something stupidly obvious. PLZ Save me! ;) Thanks much in advance! Dim quer...

vb.net compare generic types

I have a class which I use to record a value in a given interval. I.e. the value between 0 and 1 might be 0.5, 1 to 5 might be 1, and 5 to 100 might be 5. However I would like to have this information stored in a class that uses generics. So when I try to find out the value in a certain interval I would like to be able to call on a fun...