Is There Version Of Shorthand If-Then-Else In C#
Nov 18, 2010Possible Duplicate:Is there a conditional ternary operator in VB.NET? Is there a version of the shorthand If-Then-Else in C#:[code]
View 2 RepliesPossible Duplicate:Is there a conditional ternary operator in VB.NET? Is there a version of the shorthand If-Then-Else in C#:[code]
View 2 RepliesHow they relate and differ from each? What are the best practices for version control? Is there a primer about publish online? Or a good book?
And is it possible to make ClickOnce and a msi in one solution of VS 2008? If so, is there any conflict or pitfall?
BTW I am using VB if that makes any difference.
Is there a VB.net equivalent to the C#:
public string FirstName { get; set; }
I know you can do
Public Property name() As String
Get
Return _name.ToString
[code].....
But I can't seem to google up an answer on a vb shorthand.
Currently, I have code similar to this:
xxx, _
If(dr.Table.Columns.Contains("EnterpriseID"), dr.Field(Of Integer)("EnterpriseID"), -1), _
xxx
I would like to create a Lamdba expression something like the following (this doesn't work):
Dim xCol As Func(Of DataRow, String, Type, Object, Object) = _
Function(dr, x, t, dflt) _
If(dr.Table.Columns.Contains(x), dr.field(Of t)(x), dflt)
So that I can say something like:
xxx, _
xCol(dr, "EnterpriseID", GetType(System.Integer), -1), _
xxx
By accident i put in some C# shorthand synthax in a vb.net project, and to my suprise, it compiled and runs fine! Does anyone know if this was a framework update? I can't find any documentation that points this out
The following Vb.net code works fine for me
Dim someDate As DateTime? = Nothing
If someDate.HasValue Then
Console.WriteLine(someDate.Value)
End If
This is hopefully a softball syntax question: I need to call a method with an empty Object array for evaluation and set initial state. In C# I would just do this:
func(new Object[]{});
In VB.NET I am forced to do this:
Dim ctrls() As Control = {}
func(ctrls)
Is there a way to shorthand the call in VB.NET and have everything happen in one line of code?
This code no longer works in ver 2007:' Obtain max resources available for Excel
[Code]...
Is there any way to make my programs use a lower version of net.framework other than the newest version 4 that comes with VS2010?I use my programs within a closed network and there isn't an easy way for me to install any software since I'm not the administrator.
View 3 RepliesI'm trying to add functionality to my application that will disable buttons and checkboxes depending on what version the OS is when the app is launched. I made a test app to test this but unfortunately I can not get it to work. Here is my code:
'OS Check
Dim osValue As Object
osValue =
My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrent Version", "CurrentVersion", "5.2")
[Code]...
*Note - 5.2 is Windows 2003, 6.0 is Vista, 5.1 is Windows XP
I have created a license system for my application with MySql about half a year ago. What it would do is take the serial number and send it to my server if the key was correct it would return a 0 if its wrong the return value would be a 1.The problem was that when the serial number was entered correctly my program would create a "fake file" for example vb.dll in the system.And on run time my program would check for that vb.dll if the file exist it would skip my trial program and run the app as a full version. Half year later i think creating a "fake file" and checking for it on start up is extremely wrong and that's not very good security.How can i check the difference between a full version and unregistered version?
View 23 RepliesI'm working with Ticks a lot at the moment and when setting a timespan/similar, I find the shorthand exponent notation 3e6 far more easy to read at a glance than 3000000
VS converts to the long form as soon as it tidies up the line.
Is there any way to turn off the editor feature which reformats this?
I have a XML file with the latest application version number, I have this loaded into a variable, how can i compare this against the application.info.version to see if it's the latest version??
View 3 RepliesSo I'm just trying to understand why someone would want to use the shorthand property instantiation
Public Property CarModel As String <-- property
As opposed to
Public CarModel As String <-- variable
I want my application to do something special :D.. jks
I just want it to compare assembly version to the file version something like this (btw i also want it if it is the same i want it to enable a button):
Private Sub StartSplash_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
If Assembly Version = File Version Then
[Code].....
so how do i detect Assembly & File version numbers?
I would like my program to overwrite its previous version such that users don't have to uninstall the previous version before installing the new one.
I'm guessing it has something to do with setting Publish Version (Major, Minor, Build, Revision), Assembly Version or File Version.
they need to make some compare version between host version and client version.. and each 1 version different will download the file to the client..[URL]..with both example, how can i make a program in VB.NET just like i said just now?
View 15 RepliesHow come software created in an older framework version won't run on a newer framework version? Actually whenever i try to run some old specific software having .net 3.5 framework on my PC they show they needs .net framwork 1.1 . What a bad thing?My newer version of Photoshop ans Ms office open all lower version files.
View 6 RepliesI am using an about Box in my program and the version number doenst change.Its 1.0.0.0.0 , does anyone know how to sink the version number in the box with the version number being published.
View 3 Repliesi want to get the .dll version in vb.net and .exe version in vb.net in vs2008.i want to know that dll is released version or debug version
View 4 Repliesi am looking to create my own version of CMD ,embedded into my program. Being a noob I dont know where to start.JUst really looking to be pointed in the right direction.
View 14 RepliesA few years ago I started development of an application using VB6.0. We shelved the project but are now looking at reviving it. In addition, we are looking at developing another application that we probably could design using use VB. Our OS: PC, XP SP3; Server, Windows Server 2000.
We plan to use both applications in our business; however, we believe there may be opportunities to develop and market both.What versions of VB are available? Is Visual Studio VB? [Please excuse my ignorance... I did not stay at a Holiday Inn Express last night. :)]
What version of VB would be best for us to use?
I am a heavy user of Telerik's library of controls, specifically for ASP.NET. However, there is a small bit of functionality which I wanted to add to some of the controls. Nowadays I can do this easy enough using Extension methods. So I wrote a small library which does exactly that. Obviously, this library needs to reference their DLL (Telerik.Web.UI.dll).In the My Project > References page of my DLL project, I have a reference to Telerik.Web.UI.dll. For this reference, I have the Specific Version property set to False, because I don't want my library to care about what version of the Telerik DLL is being used. THIS is my problem though... the .NET compiler doesn't seem to honor this setting.
Case in point, I have a website which references both the Telerik DLL and mine. I updated the Telerik library to the latest version. Now when I try to run my website, I get: Could not load file or assembly 'Telerik.Web.UI, Version=2012.1.215.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)I fix this by going to my DLL project, recompiling it against the latest Telerik DLL, and then updating my DLL in the website. This is precisely what i didn't want to have to do every time I update Telerik's library. I thought that setting Specific Version to false would mean it would work with any version. No?
I am running windows vista with 1gb memory and 2ghz proccessor. What would be the best FREE version of .NET to use for best performance? Its been years since I have done any PC programming and I would like to do a little bit =]
View 6 RepliesFrom the documentation:
The CTypeDynamic method applies dynamic conversions in accordance with the conversion semantics defined by the object itself. If a dynamic object inherits from DynamicObject, the CTypeDynamic method first attempts to perform the conversion by using a user-defined, static conversion. If the user-defined, static conversion fails, the CTypeDynamic method attempts to perform the conversion by using dynamic conversions. If a dynamic object implements IDynamicMetaObjectProvider, the CTypeDynamic method gives precedence to dynamic conversions over user-defined, static conversions.
Is there something in C# that does this? Or do I just have to import the VB library that has it.
I'm wanting to code my button to check the OS to see if it is 32 or 64 bit to run the correct application. How can I do this?
View 2 RepliesI just ran into a problem that I did not really give too much thought to when I started building my app .I'm releasing the first version of a fairly sizable application to my users. There are going to be two types of changes: Corrections and Enhancements. If a correction is required (ie, user finds an error in the app and I need to fix it right away) I will make the change in the code, and republish the app for the users to dwnload.My problem is that I have to start working on the second release objectives, and that requires changing some of the underlying structure of the app... that being the case, I cannot accomplish this in the production version of the app and thereby need to create a test version to parallel the production version.
If I do this, how do I merge the two applications later? If this was two excel files, I would just save the newest one to override the old one (when ready for release2), but there is no "save project as" in vs.net (2008).
"Error # 5 was generated by Microsoft JET Database Engine" regarding databases created with earlier versions of Microsoft Jet. This is nice and true, for instance the function using GetOleDbSchemaTable creates the error.(schemaTable = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, New Object() {Nothing, Nothing, tblname, Nothing}) )
But how can we find out which version was used? In VB 6 we could get the database version using Set db = OpenDbRead(Dbase)Version = db.Version db.Close And we could get the Engine version through: DBEngine.Version But in VB.Net, can that be done? How?And then hopefully the problem can be solved via the .CompactDatabase function.
I'm working on a VB.Net Project and someone suggested me to use the VB2008 IF(a,b,c) operator. I think I am using VB2005, but I can't find where to confirm that information.
Also, is the server's IIS version important for the VB version used? (I think so, but I'd like confirmation... And a way to know what IIS version match what VB version).
How can I get the versioning info which is located in the properties of a non-running application. In other words, something perhaps as simple as :[code...]
View 2 Repliesi want to get PDF file version using VB.NET, can i use System.Diagnostics.FileVersionInfo namespace for that
View 9 Replies