|
No. File is editable like all project files.
|
|
|
|
|
I try to learn simple network programming by using vb.net that I got some problem. I don't know how to get the ipv6 address on my machine.
Please explain in details because I'm just a novice in prigramming.
Thankyou
|
|
|
|
|
' This program shows how to use the IPAddress class to obtain a server
' IP addressess and related information.
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Text.RegularExpressions
Imports Microsoft.VisualBasic
Namespace Mssc.Services.ConnectionManagement
Module M_TestIPAddress
Class TestIPAddress
'The IPAddresses method obtains the selected server IP address information.
'It then displays the type of address family supported by the server and
'its IP address in standard and byte format.
Private Shared Sub IPAddresses(ByVal server As String)
Try
Dim ASCII As New System.Text.ASCIIEncoding()
' Get server related information.
Dim heserver As IPHostEntry = Dns.Resolve(server)
' Loop on the AddressList
Dim curAdd As IPAddress
For Each curAdd In heserver.AddressList
' Display the type of address family supported by the server. If the
' server is IPv6-enabled this value is: InternNetworkV6. If the server
' is also IPv4-enabled there will be an additional value of InterNetwork.
Console.WriteLine(("AddressFamily: " + curAdd.AddressFamily.ToString()))
' Display the ScopeId property in case of IPV6 addresses.
If curAdd.AddressFamily.ToString() = ProtocolFamily.InterNetworkV6.ToString() Then
Console.WriteLine(("Scope Id: " + curAdd.ScopeId.ToString()))
End If
' Display the server IP address in the standard format. In
' IPv4 the format will be dotted-quad notation, in IPv6 it will be
' in in colon-hexadecimal notation.
Console.WriteLine(("Address: " + curAdd.ToString()))
' Display the server IP address in byte format.
Console.Write("AddressBytes: ")
Dim bytes As [Byte]() = curAdd.GetAddressBytes()
Dim i As Integer
For i = 0 To bytes.Length - 1
Console.Write(bytes(i))
Next i
Console.WriteLine(ControlChars.Cr + ControlChars.Lf)
Next curAdd
Catch e As Exception
Console.WriteLine(("[DoResolve] Exception: " + e.ToString()))
End Try
End Sub 'IPAddresses
' This IPAddressAdditionalInfo displays additional server address information.
Private Shared Sub IPAddressAdditionalInfo()
Try
' Display the flags that show if the server supports IPv4 or IPv6
' address schemas.
Console.WriteLine((ControlChars.Cr + ControlChars.Lf + "SupportsIPv4: " + Socket.SupportsIPv4.ToString()))
Console.WriteLine(("SupportsIPv6: " + Socket.SupportsIPv6.ToString()))
If Socket.SupportsIPv6 Then
' Display the server Any address. This IP address indicates that the server
' should listen for client activity on all network interfaces.
Console.WriteLine((ControlChars.Cr + ControlChars.Lf + "IPv6Any: " + IPAddress.IPv6Any.ToString()))
' Display the server loopback address.
Console.WriteLine(("IPv6Loopback: " + IPAddress.IPv6Loopback.ToString()))
' Used during autoconfiguration first phase.
Console.WriteLine(("IPv6None: " + IPAddress.IPv6None.ToString()))
Console.WriteLine(("IsLoopback(IPv6Loopback): " + IPAddress.IsLoopback(IPAddress.IPv6Loopback).ToString()))
End If
Console.WriteLine(("IsLoopback(Loopback): " + IPAddress.IsLoopback(IPAddress.Loopback).ToString()))
Catch e As Exception
Console.WriteLine(("[IPAddresses] Exception: " + e.ToString()))
End Try
End Sub 'IPAddressAdditionalInfo
Public Shared Sub Main(ByVal args() As String)
Dim server As String = Nothing
' Define a regular expression to parse user's input.
' This is a security check. It allows only
' alphanumeric input string between 2 to 40 character long.
'Define a regular expression to parse user's input.
'This is a security check. It allows only
'alphanumeric input string between 2 to 40 character long.
Dim rex As New Regex("^[a-zA-Z]\w{1,39}$")
If args.Length < 1 Then
' If no server name is passed as an argument to this program, use the current
' server name as default.
server = Dns.GetHostName()
Console.WriteLine(("Using current host: " + server))
Else
server = args(0)
If Not rex.Match(server).Success Then
Console.WriteLine("Input string format not allowed.")
Return
End If
End If
' Get the list of the addresses associated with the requested server.
IPAddresses(server)
' Get additonal address information.
IPAddressAdditionalInfo()
End Sub 'Main
End Class 'TestIPAddress
End Module
End Namespace
Nothing is Impossible in Life Need Is Try for It
Think Big Get Big
Don’t Forget To Rank Best Post
|
|
|
|
|
Thnakyou
|
|
|
|
|
Hi Folks,
Can any one tell me how to sort a column in datagrid?????I have done the sorting which works fine when we click the headertext in ascending and descending accordingly.
Now i need the same functionality when i click the up and down arraows placed side of the header text.....is it possible to place images beside hearder text???
Thanks
Vin1070
|
|
|
|
|
Hi,
i have datagridview in my vb.net(winforms) application,
& have combox in every cell of a column of Customer's name
How to Access Current Index Of Combobox which is in Datagridview??
priya
|
|
|
|
|
Hi Priya,
You can get current index from ComboBox1.SelectedIndex .
|
|
|
|
|
thnx for help
yes i know it, but my datagridview columntype as combobox so how to access curr index property of that datagridview cell of type combobox.
Please help me
priya
|
|
|
|
|
priya,
can u copy and paste the piece of code which u r using or e-mail me??
|
|
|
|
|
hi ,
i wrote following code -->
MyCommand.CommandType = CommandType.Text
MyCommand.CommandText = "SELECT CustName FROM cust_mast;"
MyCommand.Connection = conn
MyDataAdapter.SelectCommand = MyCommand
MyDataAdapter.Fill(dt)
''---------------------------------
DGTimeSheet.AutoGenerateColumns = False
CombCust = New DataGridViewComboBoxColumn
With CombCust
.DataSource = dt
.DataPropertyName = "Custname"
.ValueMember = "Custname"
.DisplayMember = "Custname"
.HeaderText = "Custname"
.DropDownWidth = 200
.Width = 90
.MaxDropDownItems = 3
.FlatStyle = FlatStyle.Flat
End With
DGTimeSheet.Columns.Insert(0, CombCust)
DGTimeSheet.Columns(0).Width = 235
''-----------------------------------------------------
now wht i wnt is->
i wnt to take one more combobox which is filled with customerID & at runtime when we select item in datagridview's Customer comboColumn , it should set current index of that other customerID
comboBox same as datagridview's customer comboBox column.
(coz i have to fill next combocolumn, depending on which customer, i have selected in that row.& as custid is primary key, i require related customerID of selected customer)
As it is possible for our normal comboboxes by writing code-->
Private Sub cmbcust_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmbcust.SelectedIndexChanged
cmbCustId.SelectedIndex = cmbcust.SelectedIndex
End Sub
d
but i didnt get the current index of a combobox that is in datagridview
Will u please tell how shuld i do it.
--Regards Priya
priya
|
|
|
|
|
Hello,
Is there any way i can zip files on my machine through vb.net??
Regards,
Nilesh.
|
|
|
|
|
.NET 2005 has classes for it, I think. 2003 and 2002 do not.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
|
thanks you very much for the help.
That was really useful.
|
|
|
|
|
Hi, I just install visual studio 2005 standard edition. But I need two additional feature that integrate with visual studio. First I need to have a visual studio too for Ms. office in the project template and Second I need have crystal report to be integrated with visual studio. From here, I have the below question:
1. After I purchase vs.net for ms office tool, do i need to uninstall vs.net 2005 standard edition or just upgrade via the installation CD/DVD?
2. Vs.net 2005 standard do not have crystal report integrat with. Is it possible for me to purchase the separate crystal report product to install and make it integrated with vs.net 2005 standard? If possible, which crystal report product version that I require to purchase?
Thank in advance!!!
|
|
|
|
|
I am trying to convert the Wininet code from VB 6 to VB .NET.
The function FtpCallbackStatus(ByVal hInternet As Long, ByVal dwContext As Long, ByVal dwInternetStatus As Long, ByVal lpvStatusInfo As Long, ByVal dwStatusInfoLength As Long) As Long
does not work with VB .NET
I tried the "delegate" and other method and it did not seem to work.
Does anyone know the quick fix for this?
Tony N.
|
|
|
|
|
WebRequest is here right?
|
|
|
|
|
I have an access database that exports an Excel spreadsheet. Currently I have to open the spreadsheet, select all, format columns/autofit and do the same for rows.
Is there VB code that can automatically do an autoformat?
Thanks!
_________________________________________________________________
Dick Cheney looks like a high school calculus teacher with persistent heartburn.
|
|
|
|
|
This code comes from an Excel VB macro:
Public Sub OpenExlFile(ExcelPath As String)<br />
Workbooks.OpenText FileName:=ExcelPath, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Local:=True<br />
Workbooks.Application.Columns.AutoFit<br />
'Workbooks.Application.Columns.AutoFormat<br />
'Workbooks.Application.Rows.AutoFormat<br />
End Sub
The last two lines were commented out because they badly slowed down opening the document, but they do also work.
For what it's worth,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I'm using VS2005 and clickonce technology. When I publish a new version of my program to my clients their isolated storage settings do not upgrade to the new version I've published.
When using app config or user config settings on the 2.0 framework, you can use the Settings.upgrade code to pull the settings up to the new version published.
Is there similar code to pull my isolated storage settings up to my new published version?
Lost in the vast sea of .NET
|
|
|
|
|
This is from one of the previous thread and I only got one response. One of the good fellow at CodeProject told me to use Struct. But I know there is a natural way to customize the controls to have more than value or to change their value type.
There is a object called DataGridViewCell which can be inherited to create my own myCustomGridViewCell
But the thing is how can I tell the DataGridView to use myCustomGridViewCell instead of default DataGridViewCell. I know there is a way but trying to figure out. This will be easiest way of saving as many differect values as possible in one cell. And you can easily Set or Get them by:
DataGridView1.item(0,0).myValue1 = "This is first Custom Value"<br />
DataGridView1.item(0,0).myValue2 = "This is Second Custom Value"<br />
DataGridView1.item(0,0).myValue3 = "This is third Custom Value"
I can create myCustomGridViewCell by creating a Public Class (as shown below)
<br />
Public Class myCustomGridViewCell<br />
Inherits DataGridViewCell<br />
Public myValue1 As String<br />
Public myValue2 As String<br />
Public myValue3 As String<br />
End Class
The problem is how can I tell the DataGridView to use myCustomGridViewCell
There will be a way to override the DataGridView1 class to define my custom obects.
-- modified at 13:50 Monday 29th January, 2007
|
|
|
|
|
In the project settings, when you define an item as an StringCollection then you access each item using its index but not by name. Is there any way to assign a name for each item in the string collection?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
That's not a string collection, it's a Dictionary/HashTable.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
I'm not a developper, but an Oracle DBA. I'm new to scripting in windows (better on unix). I tried to create a script to get configuration values that Oracle store in an XML file and use them. I encounter an error, which seems to be a object/variable type casting error :
C:\WinScripts\Myscript\switch_all_logs.vbs(73, 3) Erreur d'exécution Microsoft VBScript: Objet requis: '[string: "C:\oracle\ora92"]'
My code :
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<br />
'Title : switch_all_logs.vbs<br />
'Description : Switch All Oracle RDBMS logfiles<br />
'Author : G.Reboute<br />
'Company : <br />
'Created : 29/01/2007<br />
'Rel. : 1.0<br />
'Rel. Date : 29/01/2007<br />
'Purpose : to rename <namefile.log> into <namefile.log.YYYYMMDD><br />
'Note : produces a log of the executed actions in the execution <br />
' directory named "switch.log" and an Application Log entry also<br />
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<br />
Option Explicit<br />
'Variables<br />
Dim WSHShell, objArgs, XMLread, XMLreader<br />
Dim strOracleRegKey, strInvLoc, strOracleHome, retcode, strDir<br />
Dim xmlDoc, xmlHomeList, xmlRoot, xmlNode, myErr, i<br />
Dim oFileSys, xmlAttrib, toto<br />
<br />
' On est oblige de ne pas tenir compte des erreurs au debut du script<br />
' car la methode RegRead ne renvoit pas de code erreur "attrapable"<br />
Err.Clear<br />
On Error Resume Next<br />
Set WSHShell = WScript.CreateObject("WScript.Shell")<br />
Set objArgs = WScript.Arguments<br />
Set oFileSys = CreateObject("Scripting.FileSystemObject") <br />
strDir = oFileSys.GetAbsolutePathName(".\")<br />
<br />
' Lecture du repertoire d'inventory Oracle<br />
strOracleRegKey = "HKLM\software\oracle\inst_loc"<br />
strInvLoc = WSHShell.RegRead(strOracleRegKey)<br />
If Err.number <> 0 then<br />
WScript.Echo("L'erreur de lecture de la cle = " & Err.number)<br />
' Si ce n'est pas defini on essaye a l'emplacement par défaut<br />
strInvLoc = "C:\Program Files\Oracle\Inventory"<br />
End if<br />
' On remet en route la gestion des erreurs<br />
On Error goto 0<br />
<br />
'Creation du Document Xml<br />
Set xmlDoc = CreateObject("Microsoft.XMLDOM") <br />
'WScript.Echo("Le fichier = " & strInvLoc & "\ContentsXML\inventory.xml")<br />
<br />
' Chargement du XML et gestion des erreurs<br />
xmlDoc.Load(strInvLoc & "\ContentsXML\inventory.xml")<br />
If xmlDoc.parseError.errorCode <> 0 Then<br />
myErr = Err.Description & vbCrLf<br />
myErr = myErr & xmlDoc.parseError.reason & " ligne: " & _ <br />
xmlDoc.parseError.Line & " col: " & _<br />
xmlDoc.parseError.linepos & _<br />
" texte: " & xmlDoc.parseError.srcText<br />
MsgBox myErr, vbCritical, "Une erreur est apparue durant le chargement"<br />
WScript.Quit 1<br />
End If<br />
<br />
' xmlRoot est l'image du document en "pur" XML<br />
Set xmlRoot = xmlDoc.DocumentElement<br />
'WScript.Echo(root.xml)<br />
<br />
' On se positionne sur le bon noeud<br />
Set xmlHomeList = xmlRoot.SelectNodes("HOME_LIST/HOME")<br />
If xmlHomeList.length <=0 then<br />
WScript.Echo("Je n'ai rien pu trouver pour HOME_LIST/HOME")<br />
WScript.Echo("Etes vous bien sur qu'il s'agisse d'un fichier d'inventaire Oracle ?")<br />
WScript.Quit 2<br />
End if<br />
'WScript.Echo("On passe a la recherche proprement dite" & VBCRLF & VBCRLF & VBCRLF )<br />
i = 0<br />
For Each xmlNode In xmlHomeList<br />
' WScript.Echo(xmlNode.nodeName)<br />
Set xmlAttrib = xmlNode.Attributes.getNamedItem("LOC")<br />
' The error appears on the next line<br />
Set strOracleHome = xmlAttrib.Value<br />
Wscript.Echo "Oracle Home " & i & " = " & strOracleHome<br />
Wscript.Echo "Current Dir = " & strDir<br />
Wscript.Echo "Commande = " & strDir & "\switchlistenerlog.vbs " & chr(34) & xmlAttrib & chr(34)<br />
' retcode = WSHShell.Run(strDir & "\switchlistenerlog.vbs " & chr(34) & xmlAttrib & chr(34), 1)<br />
If retcode <> 0 Then<br />
WScript.Echo("script de switch des logs du listener introuvable")<br />
WScript.Quit 3<br />
End If<br />
Set strOracleHome = Nothing<br />
Set xmlAttrib = Nothing<br />
i = i + 1<br />
Next<br />
The XML file (I had to add the spaces to show it on the board):
<br />
< ?xml version="1.0" standalone="yes" ?><br />
< !-- Copyright (c) 2005 Oracle Corporation. All rights Reserved --><br />
< !-- Do not modify the contents of this file by hand. --><br />
< INVENTORY><br />
< VERSION_INFO><br />
< SAVED_WITH>10.2.0.1.0</SAVED_WITH><br />
< MINIMUM_VER>2.1.0.6.0</MINIMUM_VER><br />
< /VERSION_INFO><br />
< HOME_LIST><br />
< HOME NAME="OraHome92" LOC="C:\oracle\ora92" TYPE="O" IDX="1"/><br />
< HOME NAME="OraHomeClient10g" LOC="C:\oracle\10.2.0\client" TYPE="O" IDX="2"/><br />
< /HOME_LIST><br />
< /INVENTORY><br />
When I make an echo of xmlNode.Attributes.getNamedItem("LOC"), it's OK, I get the value of the attribute, but when I want to use it as a string, I got the error.
|
|
|
|