|
Dave,
I'm not sure what you're saying here....is what you are describing that my new vb.net 2005 application (which uses framework 2.0) is trying to run using framework 1.0 and failing? Even though both frameworks 1.0 and 2.0 are *both* installed on the machine?
Is it possible that I've compiled (in vb.net 2006) an app that is forcing itself to use the 1.0 framework by mistake? How would this be "deterred" if so?
|
|
|
|
|
Any app compiled under .NET 2.0 (VB.NET 2005) will run under 2.0 first, if it's available. If not, it'll use the highest version .NET Framework installed, if possible.
Using VB.NET 2005, there's no way you could possibly have compiled it under a 1.x .NET Framework by mistake. The compilers used by Visual Studio are not in Visual Studio, but are an integral part of the .NET Framework.
If your app crashed, does anything show up in the machines event logs (Application, Security, or System)??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ah. That makes sense...Since both frameworks are installed, it should be safe to assume that the correct version is being used.
No, nothing in the event logs (any of them). Just the before-mentioned error message/dialog.
Ideally, I'd like to be able to "self enclose" my in-house apps in a folder, then to installations by copying this folder to machines on our network. I've done this in the past with 2003, and even place folders of apps on a linux server that users on windows boxes can run from their desktops.
However, since switching to 2005 this seems a bit more unpredictable. There has to be a reliable method of guaranteeing that all references for an app are in a folder to be copied to to local machine *without* having to perform a full install. Someone on a newsgroup suggested ClickOnce, but this seems just as skittish, and only installs for the current user.
|
|
|
|
|
smarr wrote: There has to be a reliable method of guaranteeing that all references for an app are in a folder
No, there isn't. Not all dependencies can be reliably traced by code and some dependencies are just assumed to be available on target machines. There are just too many different ways you can call code, both managed and unmanaged, that reside outside of the assemblies of your app.
You have to test your distributions before you roll them out to the masses. I like to distribute Debug code to a couple of test machines (VMWare or Virtual PC comes in real handy for this!) to make sure it works before I retest it again using Release versions. This does a pretty good job of catching those natsty little errors your seeing on your client machines.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Correct me if I'm wrong here, but wasn't one of the tenets of DotNet that--because dlls and "called components" could all be contained within an app's installation folder--that it cured DLL hell-type issues like this?
If the installer gets the information on what to install from the app itself, and the installer works but copying all the listed references does not, then by association the installer is doing something *extra* that it is not being told by the app (or at least, the info isn't visible to the user). There has to be a manner of seeing this info so that I can manually copy those file independently and make sure they are there. Perhaps an app that can detect what refs are being called during an app's execution.....
|
|
|
|
|
I can't figure out how to use the the system.drawing.font to set multple properties of a fontstyle. For example:
Dim vbFont3 As New System.Drawing.Font("Century Schoolbook", 12, FontStyle.Bold)
I would like to also be Italic.
Anybody know how to do this?
Jerry Hogan
|
|
|
|
|
FontStyle is has a FlagsAttribute. This means that you can combine them using bit-wise operations, like And and Or, like this:
Dim vbFont3 As New Font("Century Schoolbook", 12, FontStyle.Bold Or FontStyle.Italic)
This will create a new Font that is both Bold AND Italic, despite the Or operator in there. Remember, it's a bit-wise OR. Not one or the other.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave,
U the Man
|
|
|
|
|
hi
Dim DR As OdbcDataReader
Dim ConnStr As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=AgentImg;uid=root;pwd=;option=3"
Dim con As OdbcConnection = New OdbcConnection(ConnStr)
Dim ad As OdbcDataAdapter = New OdbcDataAdapter()
Dim strCommand As String = "Select * from login where UserName= '" & Trim(TextBox1.Text) & "' And Password= ' " & Trim(TextBox2.Text) & "' "
Dim InsCom As OdbcCommand = New OdbcCommand(strCommand, con)
con.Open()
ERROR DR = InsCom.ExecuteReader()
If (DR.HasRows) Then
MsgBox("welcome")
Else
MsgBox("Wrong Information")
End If
con.Close()
End Sub
actually i'm using mysql for this i'm using ODBC.
I declare
Dim DR As OdbcDataReader.
but when i tried
DR = InsCom.ExecuteNonQuery()
Value of type 'Integer' cannot be converted to 'System.Data.Odbc.OdbcDataReader'.
WHAT IS THE PROBLEM
|
|
|
|
|
Are you really sure that this is the actual code that gives that error message?
The ExecuteReader method returns an OdbcDataReader object, so it shouldn't produce that error message. From the error message it looks more like you are using the ExecuteNonQuery method instead.
---
b { font-weight: normal; }
|
|
|
|
|
hi yes u have great knowledg there is no doubt abt it.
im making a project could u help me.
i want ur guidance.......
i hope u will....
i have to make a CategoryMaster form in which every cateory have a Image.
& this point is confusing me.
how i will display the image dynmically...& in which control.....
because i have to display these images in 4* 4 matrix.
please give some suggestion.
|
|
|
|
|
Hello,
I realy like the program the MahendranG made (HostName, IP And MAC Address). The only problem is that I don't know anything about C# and little about VB.NET... the program is in C#. Anyway, I worked on the converion from C# to VB.NET but having some problems. When I run the program and click the Display button I get the following message...
Error: Arithmetic operation resulted in an overflow.
I click the OK button and the program closes. Now, I also get one warnings; Public Property Address() As Long' is obsolete: 'This property has been deprecated. It is address family dependent. Please use IPAddress.Equals method to perform comparisons. But if I change it I get a hole pack of errors. Can anyone please help me with this?
Improts
<br />
Imports Microsoft.VisualBasic<br />
Imports System<br />
Imports System.Drawing<br />
Imports System.Collections<br />
Imports System.ComponentModel<br />
Imports System.Windows.Forms<br />
Imports System.Data<br />
Imports System.Net<br />
Imports System.DirectoryServices<br />
Imports System.Runtime.InteropServices<br />
C#
<br />
private void ButDisplay_Click(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
<br />
this.Status.Text = "Collecting Information...";<br />
<br />
if(this.TxtWorkGroup.Text.Trim() == "")<br />
{<br />
MessageBox.Show("The Work Group name Should Not be Empty");<br />
return;<br />
}<br />
<br />
<br />
DirectoryEntry DomainEntry = new DirectoryEntry("WinNT://" + this.TxtWorkGroup.Text.Trim());<br />
DomainEntry.Children.SchemaFilter.Add("computer");<br />
<br />
<br />
foreach(DirectoryEntry machine in DomainEntry.Children)<br />
{<br />
string[] Ipaddr = new string[3];<br />
Ipaddr[0] = machine.Name;<br />
<br />
System.Net.IPHostEntry Tempaddr = null;<br />
<br />
try<br />
{<br />
Tempaddr = (System.Net.IPHostEntry)Dns.GetHostByName(machine.Name);<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show("Unable to connect woth the system :" + machine.Name );<br />
continue;<br />
}<br />
System.Net.IPAddress[] TempAd = Tempaddr.AddressList;<br />
foreach(IPAddress TempA in TempAd)<br />
{<br />
Ipaddr[1] = TempA.ToString();<br />
<br />
byte[] ab = new byte[6];<br />
int len = ab.Length;<br />
<br />
int r = SendARP( (int) TempA.Address, 0, ab, ref len );<br />
string mac = BitConverter.ToString( ab, 0, 6 );<br />
<br />
Ipaddr[2] = mac;<br />
} <br />
<br />
System.Windows.Forms.ListViewItem TempItem = new ListViewItem(Ipaddr);<br />
<br />
this.ListHostIP.Items.Add(TempItem);<br />
}<br />
<br />
this.Status.Text = "Displayed";<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message,"Error",System.Windows.Forms.MessageBoxButtons.OK );<br />
Application.Exit();<br />
}<br />
<br />
}<br />
VB.NET Conversion
<br />
Private Sub ButDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButDisplay.Click<br />
Try<br />
<br />
Me.Status.Text = "Collecting Information..."<br />
<br />
If Me.TxtWorkGroup.Text.Trim() = "" Then<br />
MessageBox.Show("The Work Group name Should Not be Empty")<br />
Return<br />
End If<br />
<br />
<br />
' Use Your work Group WinNT://&&&&(Work Group Name)<br />
Dim DomainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" & Me.TxtWorkGroup.Text.Trim())<br />
DomainEntry.Children.SchemaFilter.Add("computer")<br />
<br />
<br />
' To Get all the System names And Display with the Ip Address<br />
For Each machine As DirectoryEntry In DomainEntry.Children<br />
'INSTANT VB NOTE: The local variable Ipaddr was renamed since Visual Basic will not uniquely identify class members when local variables have the same name:<br />
Dim Ipaddr_Renamed As String() = New String(2){}<br />
Ipaddr_Renamed(0) = machine.Name<br />
<br />
Dim Tempaddr As System.Net.IPHostEntry = Nothing<br />
<br />
Try<br />
Tempaddr = CType(Dns.GetHostEntry(machine.Name), System.Net.IPHostEntry)<br />
Catch ex As Exception<br />
MessageBox.Show("Unable to connect woth the system :" & machine.Name)<br />
Continue For<br />
End Try<br />
Dim TempAd As System.Net.IPAddress() = Tempaddr.AddressList<br />
For Each TempA As IPAddress In TempAd<br />
Ipaddr_Renamed(1) = TempA.ToString()<br />
<br />
Dim ab As Byte() = New Byte(5){}<br />
Dim len As Integer = ab.Length<br />
<br />
' This Function Used to Get The Physical Address<br />
Dim r As Integer = SendARP(CInt(TempA.Address), 0, ab, len)<br />
Dim mac As String = BitConverter.ToString(ab, 0, 6)<br />
<br />
Ipaddr_Renamed(2) = mac<br />
Next TempA<br />
<br />
Dim TempItem As System.Windows.Forms.ListViewItem = New ListViewItem(Ipaddr_Renamed)<br />
<br />
Me.ListHostIP.Items.Add(TempItem)<br />
Next machine<br />
<br />
Me.Status.Text = "Displayed"<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message,"Error",System.Windows.Forms.MessageBoxButtons.OK)<br />
Application.Exit()<br />
End Try<br />
<br />
End Sub<br />
|
|
|
|
|
Our Instant VB C# to VB.NET converter produces:
Private Sub ButDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Try
Me.Status.Text = "Collecting Information..."
If Me.TxtWorkGroup.Text.Trim() = "" Then
MessageBox.Show("The Work Group name Should Not be Empty")
Return
End If
' Use Your work Group WinNT://&&&&(Work Group Name)
Dim DomainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" & Me.TxtWorkGroup.Text.Trim())
DomainEntry.Children.SchemaFilter.Add("computer")
' To Get all the System names And Display with the Ip Address
For Each machine As DirectoryEntry In DomainEntry.Children
Dim Ipaddr As String() = New String(2){}
Ipaddr(0) = machine.Name
Dim Tempaddr As System.Net.IPHostEntry = Nothing
Try
Tempaddr = CType(Dns.GetHostByName(machine.Name), System.Net.IPHostEntry)
Catch ex As Exception
MessageBox.Show("Unable to connect woth the system :" & machine.Name)
Continue For
End Try
Dim TempAd As System.Net.IPAddress() = Tempaddr.AddressList
For Each TempA As IPAddress In TempAd
Ipaddr(1) = TempA.ToString()
Dim ab As Byte() = New Byte(5){}
Dim len As Integer = ab.Length
' This Function Used to Get The Physical Address
Dim r As Integer = SendARP(CInt(TempA.Address), 0, ab, len)
Dim mac As String = BitConverter.ToString(ab, 0, 6)
Ipaddr(2) = mac
Next TempA
Dim TempItem As System.Windows.Forms.ListViewItem = New ListViewItem(Ipaddr)
Me.ListHostIP.Items.Add(TempItem)
Next machine
Me.Status.Text = "Displayed"
Catch ex As Exception
MessageBox.Show(ex.Message,"Error",System.Windows.Forms.MessageBoxButtons.OK)
Application.Exit()
End Try
End Sub
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
hi im very new to vb,in my application i need to read the content of the excel file thro rows.i have tocheck whether the rows are left blank.thanks in advance.
and im using VB6.0
so please help me to get start my code
with regards,
susa
|
|
|
|
|
|
hi Everybody
i am working on window application in vb.net
actually i want to show my form under the visio window means to make visio as parent window for that form, how can i do that .
if anybody know please help me.
Thanks
|
|
|
|
|
You can't. You cannot make your application a child window of another application.
If you want to do something like this, you'll have to write an Add-On for Visio.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
yes i know that it can be done by using set paarent window but it is not working or i used in the wrong way if anyone of you know please help me
Thanks
-- modified at 6:47 Friday 7th April, 2006
|
|
|
|
|
Once again, NO, YOU CAN'T DO THIS!!
You can NOT make your window a child window of another application!
Why? Because when the other application repaints it's own window, your window will never get repainted. This is because your window is not going to get, and can NOT get, the WM_PAINT messages it needs to tell it to repaint at the appropriate time.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
but in visual basic 6.0 i do this several time by using set parent API.
Is this APi doesnot work in vb.nrt
Thanks
|
|
|
|
|
Exactly!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hey,
Me : Newbie in VS.NET2005
Question :
I have an application in which i define a connectionstring, sqlconnection etc.
then i can use this connection on this form!
But on another form in the same project i need exactly the same DB (Connectionstring,...)
and I don't want to type this twice!
So if my DB changes of server or gets a new name when the appplication goes live, i only have to change this at one place!
I know you can do something like this in ASP.NET
special section in WEB.CONFIG,
But where do you do this for a normal Application!
Thnx
A.
|
|
|
|
|
APP.CONFIG
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
And Where do i find this, how do i use it in my code?
|
|
|
|
|
Go to the Project menu, then click Add New Item. In the window that comes up, find and double-click Application Configuration File. A new file called app.config will be added to your project. Double-click this file to open it in an editor window. You'll see a bunch of XML stuff.
Under the <configuration> tag, add something that looks like this:
<configuration>
<configSections>
</configSections>
<appSettings>
<add key="myConnectionString" value="your connection string goes here!" />
</appSettings>
.
.
.
Now, to get this connection string from anywhere inside your app, just use:
Imports System.Configuration
.
.
.
Dim connString As String = ConfigurationSettings.AppSettings("myConnectionString")
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|