|
Hi all
I've following problem, i have an array of computer name (in LAN and not in LAN), all i want is get the domain name of specific computer (if the computer is in domain). For example, i've found a computer named "COMP1" which have controlled by a domain controller and i want to display the domain name of COMP1 (COMP1 is not in my LAN and is a internet computer which i've found by scanning IP).
I mentioned to use a function like that
Function GetDomain(ByVal sCompName As String) As String
'Do something here and get the domain name of sCompName and return to user
End Function
Is it a possible way to do that by programming with VB6?
Anyhelp might be very helpful
Thank alots!
.::LDLP::.
|
|
|
|
|
I'm using DataGridTableStyle to change the datagrid properties, but if it's using stored procedure, then it won't work, is there anybody knows why?
here is my code, when I run it, the datagrid headerText and width didn't change..
Dim DGTableStyle As New DataGridTableStyle
Dim textCol As New DataGridTextBoxColumn
grdAddPlan.TableStyles.Clear()
DGTableStyle.MappingName = "dbo.p_JobPlan"
textCol.MappingName = "EntityID"
textCol.HeaderText = " "
textCol.Width = 2
DGTableStyle.GridColumnStyles.Add(textCol)
textCol = New DataGridTextBoxColumn
textCol.MappingName = "ID"
textCol.HeaderText = "Plan ID"
textCol.Width = 30
DGTableStyle.GridColumnStyles.Add(textCol)
grdAddPlan.TableStyles.Add(DGTableStyle)
Lisa
|
|
|
|
|
I have written this code at page load and creating a dataset :
Dim cnn As MySqlConnection
cnn = New MySqlConnection ("SERVER=newserver;username=root;password=;DATABASE=new")
cnn.open()
Dim sql As String
sql = "select BillId, VenderID from tblbillMaster"
Dim dA As New MySqlDataAdapter(sql, cnn)
Dim DS As New DataSet
dA.Fill(DS, "tblBillMaster")
And I have added a Blank crystal Report in my project.
And I have added to parameter fields names: BillId , name
if my tblbillMaster have 5 rows then how these all rows
will display in Crystal REport in these two fields.
SoftWare Engineer
|
|
|
|
|
I am working on file based Messenger application (using VB.NET) in which i m using a Web Service where all my application functions are written. I have a list of users which i m desplaying in a treeview & refreshing this list every 5 seconds. I call a function from web service to get the latest list of online users. But i want to run this process in background using threads. But i m not able to do this.
Code is:
----------------------------------------------------------------------------
Private populate_userlist_thread As Threading.Thread
Private Sub RefreshUserList()
'This is my main function, here i m calling another function using thread.
populate_userlist_thread = New Threading.Thread(AddressOf PopulateUsers)
populate_userlist_thread.Start()
End Sub
'Here is the delegate
Delegate Sub GeneralDelegate()
Private invoker As GeneralDelegate
Private Sub PopulateUsers()
Dim msngr_serv_obj As MessengerService.MessengerFunctions
Dim users_dataset As DataSet
Dim i As Int32
Dim curr_node As TreeNode
Dim tree_node_collection As TreeNodeCollection
msngr_serv_obj = New MessengerService.MessengerFunctions
users_dataset = msngr_serv_obj.GetOnlineUsers
UsersTreeView.Nodes.Clear()
For i = 0 To users_dataset.Tables(0).Rows.Count - 1
If UsersTreeView.InvokeRequired = True Then
invoker = New GeneralDelegate(AddressOf RefreshUserList)
UsersTreeView.Invoke(invoker)
End If
curr_node = UsersTreeView.Nodes.Add(users_dataset.Tables(0).Rows(i).Item(0).ToString)
curr_node.ForeColor = Color.Green
Next
End Sub
----------------------------------------------------------------------------
But this code is not working fine. Can anybody plz help me. Or do u have any other solution to this problem.
Thanks
Sumit Domyan
Software Developer
ANALEC INFOTECH
|
|
|
|
|
you are invoking 'RefreshUserList' from within the 'PopulateUsers' method ?
that can't be good...
AND you should invoke ALL the GUI related methods by delegates as you did in
usersTreeView.invoke(Invoker) otherwise strange things happen.
Fade (Amit BS)
|
|
|
|
|
Thanks for reply amit.
Actually the whole problem is i m calling Refresh userlist function every 5 seconds. should i destroy the previous thread before calling the function or not.
Sumit Domyan
Software Developer
ANALEC INFOTECH
|
|
|
|
|
invoker = New GeneralDelegate(AddressOf RefreshUserList)<br />
UsersTreeView.Invoke(invoker)
that's a code from the PopulateUsers() sub... unless i'm missing something this kind of action will create threads until something bad will happen , am i missing something ?
i'll assume that either i am, or you have modified the code to invoke the RefreshUserList sub every 5.
now i think that it might be best not the destroy the previously created thread, but to monitor it's existence, possible by using a global or shared boolean member probably named 'blRefreshingUserList', each time you enter your timer event, before you create a new thread check and see whether the previous one has finished.
Although i don't see a scenario in which you won't finish refreshing in 5 secs. in 5 secs you can add A LOT or info, i think that something else is wrong,
if you wold like to send me the code and tell me what you want it to do, i'll check it and see why it is not working.
if not, you may also present more info so i can help you better, your choice (i won't steal your code anyway though)
Fade (Amit BS)
|
|
|
|
|
I am trying to build a simple application that grabs an HTML file and creates an image out of it. There is an article in codeproject that does this in C#, however, I cannot make it work and also I want to it in VB.net, and I am not very familiar with C#.
http://www.codeproject.com/internet/htmlimagecapture.asp[^]
Does anyone know if there is a VB.net version of this project, or can someone help me with figuring out how to do it in VB.net? (I have already built an app that uses mshtml to load the html, I just cant figure how to use GDI to translate into an image.)
thanks
dd
|
|
|
|
|
For example, if i have the same item name in database, then when i select the item name from the list, it will only display one item name.
|
|
|
|
|
Would anyone happen to know how to develope a windows application that counts down from 100 to 10 by 10's, and from 10 to 1 by 1's and then prints BLAST OFF! in Visual Basic.Net
Need Help!!!!!!!
|
|
|
|
|
Place a timer and a label on a form. Set the timer interval to 10,000 and enabled to true. Then add the following event handler:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static counter As Integer = 20
If counter > 10 Then
counter -= 10
If counter = 10 Then Timer1.Interval = 1000
Label1.Text = counter.ToString
ElseIf counter > 1 Then
counter -= 1
Label1.Text = counter.ToString
Else
Label1.Text = "Blast Off!"
Timer1.Enabled = False
End If
End Sub
Hope this helps
Tom
|
|
|
|
|
Thanks Tom you are a life saver. I know nothing about VB.NET but would love to know alot more in programming. I am trying to teach myself from a book I bought from a tech store on learning VB.NET. If I have anymore question would you be able to assist me if possible if you are not too busy? Once again thanks
Need Help!!!!!!!
|
|
|
|
|
Just post here, i am sure someone will help if they can. Another good source is groups.google.com, quite often the question has been asked before.
Cheers
Tom
|
|
|
|
|
I can't see the images on the toolbar buttons.
|
|
|
|
|
I need to be able to disable / enable items in a combobox. Any ideas on how to do this?
Thanks,
Tim
|
|
|
|
|
The combobox doesn't support this, it's all or nothing. You'll have to use a 3rd party component (don't know of any off the top of my head) or write and woner draw a new combobox class yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In theory this is just a visual thing; if you handle the drawing of the items in the combobox (DrawMode= OwnerDrawFixed and handle the DrawItem event of the combobox) you could display certain items as 'disabled' then handle the SelectedItemChanged event differently for those items and maybe reselect the previous item.
Hope this helps
Tom
|
|
|
|
|
Hi all,
I can't find how to break long string constants to the multiple lines.
Example:
Dim mystring as string
string.insert(0, "VeryVeryVery...
.LongLine")
The VB don't understand, that the string constant continues on the nextline.
Please help,
Thanks in advance
|
|
|
|
|
You break long strings this way.
dim mystring as string = "A very, very, very " & _
"Long line."
|
|
|
|
|
You shouldn't type a very long line in VB. It's really inconvenient.
You may write it to a file such as *.txt, then load it to your string var. It's convenient that: you can easily repair the text.
GF bos
|
|
|
|
|
Hi,
Can VB.Net convert sprite sheets to animations and if it can is their any examples or any source code available.
|
|
|
|
|
I open update forms for specific entities by Form.ShowDialog(). In some Windows XPs it works fine. In some and in WinME and Win98 it opens and immediately closes. For some Form.ShowDialog() it works fine It seems like a resporce problem. When I open the problematic forms in design view I get the following error:
Failed To Parse code: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name index.
What can the problem be? It is a very serious problem for me and I am at the edge of losing my customers! I think the only reliable way to develop .net application is notepad development!
|
|
|
|
|
I'd say you are either trying to run some code in the form load event that crashes depending on the OS (seen this happen if referencing directory listings when the 'hide known file extensions' of winexplorer is enabled) or your form is corrupted.
If the form is corrupted you should recreate from scractch. If you want to copy/past the code you should paste to notepad first and from there to vs.
Hope this helps.. can't say much more without looking at the code.
|
|
|
|
|
Thanks fot the reply. I am rewriting all the forms and this time I am not using Windows Designer.
At the begining one of my friends warned me not to us VS.NET's designer generated code and I did not listen to him Up to this point VS.NET caused a lot of problems from corrupting hard-coded Turkish characters to this problem.
But I still would like to learn the cause of the problem. I will send you the code.
Imports System.Configuration
Public Class VillageEdit
Inherits System.Windows.Forms.Form
Private useCode As Boolean = True
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TxtVillageCode As MandraApplication.MTextBox
Friend WithEvents TxtVillageName As MandraApplication.MTextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Utilities.WriteLog("VillageEdit.InitializeComponent entered")
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(VillageEdit))
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.TxtVillageCode = New MandraApplication.MTextBox()
Me.TxtVillageName = New MandraApplication.MTextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 0
Me.Label1.Text = "Köy Kodu:"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 51)
Me.Label2.Name = "Label2"
Me.Label2.TabIndex = 0
Me.Label2.Text = "Köy Adı:"
'
'TxtVillageCode
'
Me.TxtVillageCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TxtVillageCode.Location = New System.Drawing.Point(120, 16)
Me.TxtVillageCode.MaxLength = 2
Me.TxtVillageCode.Name = "TxtVillageCode"
Me.TxtVillageCode.Size = New System.Drawing.Size(48, 22)
Me.TxtVillageCode.TabIndex = 0
Me.TxtVillageCode.Text = ""
'
'TxtVillageName
'
Me.TxtVillageName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TxtVillageName.Location = New System.Drawing.Point(120, 48)
Me.TxtVillageName.MaxLength = 35
Me.TxtVillageName.Name = "TxtVillageName"
Me.TxtVillageName.Size = New System.Drawing.Size(160, 22)
Me.TxtVillageName.TabIndex = 1
Me.TxtVillageName.Text = ""
'
'Button1
'
Me.Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Bitmap)
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.Button1.Location = New System.Drawing.Point(8, 96)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(128, 32)
Me.Button1.TabIndex = 2
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'Button2
'
Me.Button2.Image = CType(resources.GetObject("Button2.Image"), System.Drawing.Bitmap)
Me.Button2.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.Button2.Location = New System.Drawing.Point(152, 96)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(128, 32)
Me.Button2.TabIndex = 3
Me.Button2.Text = "Çıkış [Esc] "
Me.Button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'VillageEdit
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
Me.ClientSize = New System.Drawing.Size(292, 142)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.Button1, Me.TxtVillageCode, Me.Label1, Me.Label2, Me.TxtVillageName})
Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.Name = "VillageEdit"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "VillageEdit"
Me.ResumeLayout(False)
Utilities.WriteLog("VillageEdit.InitializeComponent exited")
End Sub
#End Region
Public Sub New(ByVal v As Village)
Me.New()
Village = v
End Sub
Public Village As Village
Private AutoCodeAssignment As Boolean = False
Private Sub VillageEdit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Utilities.WriteLog("VillageEdit.VillageEdit_Load entered")
Me.KeyPreview = True
Me.DialogResult = DialogResult.Cancel
AutoCodeAssignment = Boolean.Parse(ConfigurationSettings.AppSettings("autoCodeAssignment"))
If AutoCodeAssignment Then
TxtVillageCode.Enabled = False
End If
If Village Is Nothing Then
Button1.Text = "Ekle [F5]"
Me.Text = "Yeni Köy Ekle"
'Auto generate a village code
If AutoCodeAssignment Then
Dim vf As New VillageFactory(Utilities.Conn)
Dim vc As VillageCollection = vf.RetrieveAll(False)
Dim index As Integer
Dim v As Village
Dim IndexFound As Boolean
For index = 1 To 100
IndexFound = False
For Each v In vc
If index = Convert.ToInt32(v.Code) Then
IndexFound = True
Exit For
End If
Next
If Not IndexFound Then
TxtVillageCode.Text = index.ToString("0#")
Exit For
End If
Next
End If
Else
Button1.Text = "Güncelle [F5]"
Me.Text = "Köy Güncelle"
TxtVillageCode.Text = Village.Code
TxtVillageName.Text = Village.Name
End If
AddHandler TxtVillageCode.KeyUp, AddressOf Control_KeyUp
AddHandler TxtVillageName.KeyUp, AddressOf Control_KeyUp
AddHandler Button1.KeyUp, AddressOf Control_KeyUp
Utilities.WriteLog("VillageEdit.VillageEdit_Load exited")
Catch ex As System.Exception
MaintainanceDevice.ReportException(ex)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
'Check Entered village code
If Not Utilities.CheckVillageCodeFormat(TxtVillageCode.Text) Then
MessageBox.Show("Geçersiz köy kodu", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error)
TxtVillageCode.Focus()
TxtVillageCode.SelectAll()
Exit Sub
End If
If TxtVillageName.Text.Length < 3 Then
MessageBox.Show("Geçersiz köy adı. Köy adı en az 3 en karakterli olabilir.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error)
TxtVillageName.Focus()
Exit Sub
End If
Dim Vt As Village
Dim vf As New VillageFactory(Utilities.Conn)
If Village Is Nothing Then
Vt = vf.GetVillage(TxtVillageCode.Text, False)
If Not Vt Is Nothing Then
MessageBox.Show("Sistemde " & Vt.Code & " kodlu bir köy (" & Vt.Name & ") bulunmakta.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error)
TxtVillageCode.Focus()
TxtVillageCode.SelectAll()
Exit Sub
End If
Vt = Nothing
Vt = vf.GetVillageByName(TxtVillageName.Text, False)
If Not Vt Is Nothing Then
MessageBox.Show("Bu isimde bir köy sistemde tanımlı", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error)
TxtVillageName.Focus()
TxtVillageName.SelectAll()
Exit Sub
End If
Village = New Village(0, TxtVillageCode.Text, TxtVillageName.Text)
Village = vf.SaveVillage(Village)
Else
Vt = vf.GetVillage(TxtVillageCode.Text, False)
If Not Vt Is Nothing And Vt.ID <> Village.ID Then
MessageBox.Show("Sistemde " & Vt.Code & " kodlu bir köy (" & Vt.Name & ") bulunmakta.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error)
TxtVillageCode.Focus()
TxtVillageCode.SelectAll()
Exit Sub
End If
Vt = vf.GetVillageByName(TxtVillageName.Text, False)
If Not Vt Is Nothing AndAlso Vt.Code <> Village.Code Then
MessageBox.Show("Bu isimde bir köy sistemde tanımlı", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Village = vf.SaveVillage(New Village(Village.ID, TxtVillageCode.Text, TxtVillageName.Text))
End If
Me.DialogResult = DialogResult.OK
Me.Close()
Catch ex As System.Exception
MaintainanceDevice.ReportException(ex)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
''Me.Close()
End Sub
Private Sub VillageEdit_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
Select Case e.KeyData
Case Keys.F5
Button1.PerformClick()
End Select
End Sub
Private Sub Control_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Try
If sender Is TxtVillageCode Then
If e.KeyData = Keys.Enter Then
TxtVillageName.Focus()
End If
ElseIf sender Is TxtVillageName Then
If e.KeyData = Keys.Enter Then
Button1.Focus()
ElseIf e.KeyData = Keys.Back Then
If TxtVillageName.Text.Length = 0 Then
If Not AutoCodeAssignment Then
TxtVillageCode.Focus()
End If
End If
End If
ElseIf sender Is Button1 Then
If e.KeyData = Keys.Back Then
TxtVillageName.Focus()
End If
End If
Catch ex As System.Exception
MaintainanceDevice.ReportException(ex)
End Try
End Sub
End Class
|
|
|
|
|
mmm... Without the missing components (village class, villagefactory,etc.) I can't compile it BUT I see you have a logical problem in the New sub: You receive v (of type Village) and then assign v to a variable 'Village' which has not been declared. The compiler does not seem to complain about this (weird!) but it could explain your problem as it usually not a good idea to name variables the same as classes (specially if the classes are in the same namespace)
Public Sub New(ByVal v As Village)
Me.New()
Village = v
End Sub
I think you meant to call the variable something else and be of type Village.
This variable is later referred to in the form_load procedure:
If Village Is Nothing Then
I don't know what VB.net does about this comparison but my guess is that it will never return true and you'll skip the code that intializes the (wrongly named) Village variable. Come to think of it I have seen MSAcess (VBA) do funky things if you make this kind of mistake.
Hope this helps.
|
|
|
|
|