vb.net

UpdatePanel + button +onClientClick = fail?

Hi, I've got an Update Panel and a button that look a bit like this: <asp:UpdatePanel runat="server" ID="querypanel" UpdateMode="Conditional"> <Triggers> <asp:AsyncPostBackTrigger ControlID="submit" /> <asp:PostBackTrigger ControlID="okbutton" /> </Triggers> <ContentTemplate> <asp:Button r...

ASP .NET MVC ViewModel object is not preserved

I am sort of new to MVC so pardon my ignorance. I am using IoC ( StructureMap ) and I have a need to pass in an instance of what I consider to be a set of Controls to each view, so I have created ViewModels in order to accomodate this. The view model is populated with an instance of the Controls and the View is then rendered. When a u...

Calculating Number of Months between 2 dates

I have the following VB.NET Code: Dim Date1 As New DateTime(2010,5,6) Dim Date2 As New DateTime(2009,10,12) Dim NumOfMonths = 0 ' This is where I am stumped What I am trying to do is find out how many months are between the 2 dates. Any help would be appreciated. ...

Multi-threaded ObservableCollection in VB

This is my attempt to create a ObservableCollection in VB that is WPF thread-safe. Can you think of any problems it may have? Public Class WpfObservableCollection(Of T) Inherits ObjectModel.ObservableCollection(Of T) Public Sub New() End Sub Public Sub New(ByVal list As List(Of T)) MyBase.New(list) End Su...

How to programatically refresh linked tables through VB.net?

I have an Access frontend with a lot of tables linked through ODBC to a MySQL backend. I have a VB.net application that sometimes adds columns to the tables in the backend, and when that happens, I need to refresh the link to the table in the frontend from the VB.net app to show the new columns. I'll consider just about any solution as...

visual studio does not recognize my dynamic user control class. Sometimes it does sometimes it doesn't

Hi I have created a user control which is inside a folder called Controls and the class is a partial class which inherits from Web.UI.UserControl. Now from my page which is one level up I just try to access the method inside the usercontrol and so trying to cast it as the type of user control. But I get build errors. It just cannot rec...

What is best way to post data to an url if someone does not call an web service?

Alright...I have kind of a big quesstion...ok here goes...Usually if i understand it well...web services work in a way that i write a method to get some data from the database and then some other user/client adds a reference and calls my service and gets the data...now in my case i have to get the data and actually post it to the user/cl...

Can I Call unmanaged Mobile CE Dll from Full .Net Framework (Run on Desktop)

I have an Unmanaged Lib compiled for Windows Ce. I am trying to call this dll from VB.net Full Framework .Net 4 Client Profile Windows application. I am trying to use the same code that I use in the Compact Framework application. It compiles without errors and runs but when Invoking a function I get error ex = {"An attempt was made to lo...

access javascript global variable from codebehind in asp.net

get the value of Global variable in javascript example var a="priti" so want to access "a" in code behind as it's global varible ...

Generation 9 digits random number including leading zero

Hi, I want to generate random number, which is 9 digits including leading zero if the number is less than 9 digits, say 123 will be 000000123. I have the following code which doesn't include leading zero : Dim RandomClass As New Random() Dim RandomNumber = RandomClass.Next(1, 999999999) Thanks. ...

How do I detect non-printable characters in .NET?

I'm just wondering if there is a method in .NET 2.0 that checks whether a character is printable or not – something like isprint(int) from standard C. I found Char.IsControl(Char). Could that be used for this purpose? ...

using async methods asp.net?

I have two methods on the page. One AddMessageToInboxOutbox(params[]) and other one SendNewMessageMail(params[]). Once user sends an message to other other first message is added to DB and then sent to recipient's email. Sometimes SMTP is heavy loaded and it takes up to 5 seconds to get answer from it. I want to enclose SendNewMessageMa...

SqlCeResultSet doesn't reflect changes if starting with empty database

I have an application with multiple SqlCeResultSets, and a combobox and a datagrid on one form. I have setup the ResultSets to return subsets of the same SQL CE table, using statements like: "SELECT * FROM DLH WHERE STATUS = 'A'" "SELECT * FROM DLH WHERE STATUS = 'D'" "SELECT * FROM DLH" Which return ResultSets named DLH_A, DLH_D and ...

vb.net Object Initialiser List(Of T)

I have been looking at some C# code: List<Employee> Employees = new List<Employee>{ new Employee{firstname="Aamir",lastname="Hasan",age=20}, new Employee{firstname="awais",lastname="Hasan",age=50}, new Employee{firstname="Bill",lastname="Hasan",age=70}, new Employee{firstname="sobia",lastname="khan",age=80}, }; N...

Help evaluating this json string array in vb.net

{"images":[{"id":"obj_0","src":"background.jpg","width":"640","height":"480"},{"id":"obj_9","src":"elements/pipe.png","width":50,"height":44,"top":196,"left":154,"rotation":"0"},{"id":"obj_13","src":"elements/cigarette.png","width":45,"height":67,"top":168,"left":278,"rotation":"0"},{"id":"obj_10","src":"elements/hat.png","width":227,"he...

<return: > attribute equivalent in Visual Basic.Net

I have a C# web method that I need to translate to VB.NET. The method has following attribute: [return: System.Xml.Serialization.XmlElement("MethodName", Namespace = "http://namespaceurl")] public CustomClass Method() .... The method returns custom class as result. How can I translate this to VB.NET? ...

Run a dll file in PHP

Hi, i have a dll file with me. I know the source code of it and also know what methods it has. What i want is to call that dll file through php. I should be able to pass parameters to that dll file and return values from that file both in PHp. After a google search what i find is, we have COM and DOTNET class available in php for reading...

OleDB/Access inserting into Date/Time field with a future date

Hi, I am writing a VB.NET application that uses OleDB to connect to an Access database. I want to insert a date that is in the future (it is chosen with a DateTimePicker) into the database. When I chose a date that is today (Jul 15, for example) or in the past it works fine. Whenever I choose a date that is in the future, it crashes. Is...

Adding new object to generit List overwrites previous values

Hi guys, I have a problem with a generic list, which consists of intances of a class i created. I am just amazed, each time I add a new object to the list, it overwrites the previous entries. Here is a code sample, i just can't beleive it. I am using visual studio 2010: Dim translations As List(Of TranslatedValue) = New List(Of Transla...

Dynamically create Public Properties

How dan I dynamically create some public properties on a custom webcontrol. For example, web control has 5 TextBox controls. I need a public property for each TextBox control to be able to set a specific property of the TextBox control. I want to be able to loop the controls in the webcontrol and create a public property for each TextB...