|
Hi I use this code to get MAC address in network adapter, when I clone this MAC adress give me cloning MAC. I want to get real (fabric) MAC address.
Imports System.Management
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mc As New ManagementClass("Win32_NetworkAdapterConfiguration")
Dim moc As ManagementObjectCollection = mc.GetInstances()
Dim MACAddress As String = [String].Empty
For Each mo As ManagementObject In moc
If MACAddress = [String].Empty Then
' only return MAC Address from first card
If CBool(mo("IPEnabled")) = True Then
MACAddress = mo("MacAddress").ToString()
End If
End If
mo.Dispose()
Next
MsgBox(MACAddress)
MACAddress = MACAddress.Replace(":", "")
' Then youc an set anything to MACAddress
MsgBox(MACAddress)
End Sub
End Class
|
|
|
|
|
ivo75 wrote: Hi I use this code to get MAC address in network adapter, when I clone this MAC adress give me cloning MAC. I want to get real (fabric) MAC address.
I'm sorry, but I really don't understand what you mean.
|
|
|
|
|
can you please give me an idea how can i implement live chat in my website? I want to know idea behind how to implement live chat Programtically. Am not looking for any gadgets or so, am looking for logic how do we in Vb.net ?
Any suggestion will be most appreciated.
Wayez
http://wayezquotes.blogspot.com
|
|
|
|
|
Syed Wayez Ahmed wrote: Any suggestion will be most appreciated.
Look at the CodeProject articles here[^], search Google for "live chat".
It's time for a new signature.
|
|
|
|
|
Thank You for your suggestion, I dnt know what is google before. You have given me a valuable suggestion.
|
|
|
|
|
Syed Wayez Ahmed wrote: Thank You for your suggestion, I dnt know what is google before. You have given me a valuable suggestion
There is no point your being sarcastic here.
It's ok that you knew about Google.
But did you do a search on it before posting this question here?
|
|
|
|
|
Did you check the CodeProject articles? Your question is one of the most common posted on this website: at least once every week. And always by people who appear too lazy to do some simple simple research for themselves.
It's time for a new signature.
|
|
|
|
|
Hi Richard!
Thnx for your replies. It seems u r angry now, being angry whn made to is quality of definately Male.
I did research and found many articles which point me to use activex which i dnt want to. and i want an ajax and saved chat can you suggest me for the same?
|
|
|
|
|
Syed Wayez Ahmed wrote: It seems u r angry now, being angry whn made to is quality of definately Male.
I apologise if I misunderstood your previous message. However your use of 'txtspk' rather than proper spelling makes it difficult to understand what you are saying.
Syed Wayez Ahmed wrote: and i want an ajax and saved chat can you suggest me for the same? Roll eyes
Same answer as before, look at the articles and search Google, this is such a common question there are many answers to be found. Select the one that best suits your knowledge and experience.
It's time for a new signature.
|
|
|
|
|
Hey Richard!
Thanx Again. Am on it(Looking for the articles in google), but if any article in your view is best, let me know ?
|
|
|
|
|
Hi, dear all,
I create a MDIContainer form (called form1) which has a TreeView on the left side, the treeview looks like and is designed at design mode:
+ Input Data
Primary Data
+ Object Data
Object 1
Object 2
Object 3
The Object number is 2 or 3, so by default I create 3 nodes, one for each object, my problems are:
1: Based on user selection about object number (2 or 3), I will decided remove (or disable or hide) Object 3 treenode, if user change the value to 3, I will add (or enable or show) this node. But I didn't find any information about disable treenode, can I disable treenode? If I use remove node, when I decide to add it back later, how can I make sure it is added at the same locatin in treeview?
2: if the user selection is stored in DB, then next time when he open the form, the object node number should be same as user selected object number, but from where I should initialize the treeview? Since the treeview is in form1 (MDI container), I thought I can do it at form1_Load() subroutine, but when I check the treenode count in it (using TreeView1.Nodes.Count),but I got value 1 instead of 6, why???
Thanks!
|
|
|
|
|
|
If you solved it yourself please post the solution so that others who have the same problem in the future can benefit from the solution as well.
|
|
|
|
|
Ok, maybe it's not an issue for most of you, but for new user like me, it may help.
When you get the node count using TreeView1.Nodes.count, it return the count of the root nodes directly under the TreeView, it doesn't include the node under subtree. If you want to get all node under TreeView, use TreeView1.GetNodeCount(True), here True means including all the nodes in subtree.
|
|
|
|
|
I have an urgent question about the datagridview and combobox column in VB2005
I am unable to show the first item in the award code field by default without selecting an item first. How can this be done?
For example CX should be shown in the blank area for the first 2 items, which shows up as blank. The 2nd issue is how can I take the data from my hidden field, which has an award code of either cd,cn,mr, etc, which is brought back in the dataset below and is on the grid but the column is just hidden. I actually need this data shown as the default in the “blank space” of the combobox. I am at a loss. So basically when I load the grid I need the award code for a specific row placed into the combo box as if it were selected for that specific row by default. So row 1 would show the following:
Row 1 would show Transfer =blank Rfa number CX08-004 Award Code=CD
Row 2 would show Transfer =blank Rfa number CX08-003 Award Code=RP
etc
etc
Below code is what I use to bind the datasource to the combo box
With grdBatchBudgetProjection ‘Dataviewgrid
With chk ‘CheckboxColumn
.DataPropertyName = "AwardCD"
.HeaderText = "Award Code"
.Width = 100
' Bind Column
.DataSource = ds3.Tables(0)
.ValueMember = "AwardID" ‘also tried AwardCD here
.DisplayMember = "AwardCD"
.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox
'dd or cbo, doesn't really matter for this field.
End With
.Columns.Add(chk)
End With
-----------------
I also tried the below code with no success. i just cannot see what I am doing incorrectly.
<pre>'Kludge loop to have combo box index= value returned from sql
'For iRowCount = 0 To ds2.Tables(0).Rows.Count - 1
Dim j As Integer = 0
For Each row As DataGridViewRow In grdBatchBudgetProjection.Rows
'' Dim Cell As DataGridViewComboBoxCell = DirectCast(grdBatchBudgetProjection.Item(5,j),
DataGridViewComboBoxCell)
Dim cell As DataGridViewComboBoxCell = DirectCast(grdBatchBudgetProjection.Item(5, j),
DataGridViewComboBoxCell)
cell.Value = ds2.Tables(0).Rows(j)(4).ToString
'Debug.Print(ds2.Tables(0).Rows(j)("AwardCD").ToString)
'grdBatchBudgetProjection.Rows(j).Cells(5).Value = ds2.Tables(0).Rows(j)
("AwardCD").ToString
j = j + 1
Next</pre>
Thank You for your time
|
|
|
|
|
Hi,I have a problem, the following piece of code will search only one field, but I would extend it to two fields (name + surname).
Unfortunately this is the first Windows Forms application that I make, are usually used to program in C # for web applications!
Thanks for your help!
Private Sub Command1_Click()
Dim NomeDaCercare As String
NomeDaCercare = InputBox$("Enter the name to search:", "Ricerca clienti")
If NomeDaCercare <> "" Then
Data1.Recordset.Index = "Nome"
Data1.Recordset.Seek "=", NomeDaCercare
If Data1.Recordset.NoMatch Then
Data1.Recordset.MoveFirst
Data1.Refresh
MsgBox "Name not found", vbInformation, Me.Caption
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
End If
End If
End Sub
|
|
|
|
|
I found this in the Microsoft Knowledge Base which may help you:
ADO Find method only supports one criteria[^]
That is assuming you are using ADO. May I suggest that you create a couple of Text Boxes on your form into which the user can enter the two names for the search criteria. Then in the Command1_click routine you can take the input from the boxes (after validating) to build the filter.
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
I have this code which is getting me most of the properties except the size of the field!
Private Sub Props()
Dim sSql As String = "SELECT * from MyTable"
Dim da As New SqlClient.SqlDataAdapter(sSql, conSQL)
conSQL.Open()
Dim ds As New DataSet
da.Fill(ds)
Dim sb As New StringBuilder
Dim tbl As DataTable = ds.Tables(0)
For Each col As DataColumn In tbl.Columns
myProperties(0) = col.DataType.ToString()'I get correct values here
myProperties(1) = col.MaxLength.ToString()' this return -1 for chars and varchars
Next
End Sub
Could someone help me to get the size of the fields, eg if the field is 50 varchar, etc. Or a better way to help me get it if this code is not the proper way.
Thanks
|
|
|
|
|
Dim sSql As String = "SELECT * from MyTable"
Dim da As New SqlClient.SqlDataAdapter(sSql, conSQL)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
conSQL.Open()
Dim ds As New DataSet
da.Fill(ds)
Source[^]
I are Troll
|
|
|
|
|
|
You're welcome
|
|
|
|
|
Hi,
I use Visual Basic 2005 from Visual Studio 2005. I read from some artical that TextBox control should have contextmenu property, but I cannot find ContextMenu property (only ContextMenuStrip) in property window, but I can see it from the object attribute like TextBox1.ContextMenu.
Also from ToolBox, I cannot fild ContextMenu control.
Is this nomal?, if now, how can I let it be shown?
Thanks!
|
|
|
|
|
Isn't it called ContextMenuStrip? It is in the 'Menus & ToolBars' group. if you dont see it you can select 'All Windows Forms' group. I guess you are probably looking for 'ContextMenu', it is called ContextMenuStrip.
Hope this helps
|
|
|
|
|
Thanks for reply.
So I should use ContextMenuStrip instead of ContextMenu, right? I saw it.
|
|
|
|
|