Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Amer Rehman 0

@Amer Rehman 0
About
Posts
19
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Which is the best and sure way to shutdown systems
    A Amer Rehman 0

    Hi I need to shutdown remote systems running on windows xp with Dotnet Framework 1.1 installed. The user is limited on these machines. I have used the following methods to shutdown the systems. 1. wmi Dim oOS, oOperatingSystem As Object                         oOS = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")                         For Each oOperatingSystem In oOS                               oOperatingSystem.Win32Shutdown(nForcePowerDown)                         Next 2. shutdown.exe of xp The problem is using the wmi sometime fails for reasons I don't know. The other method needs Admin privileges. Which is also an overhead. What should I do? Use the API or there is some other way? Please help as search over internet has not helped me much. Thanks

    reman

    Visual Basic help csharp json question

  • How to check controls created at runtime in a windows form application?
    A Amer Rehman 0

    Hi Here is the code that I've written. Private Function CheckControl(ByVal ctrlName As String) As Boolean             Dim ctrl As Control             Dim blnResult As Boolean             For Each ctrl In Me.Controls                   If ctrl.Name = ctrlName Then                         blnResult = True                   End If             Next             Return blnResult End Function The problem is that it does not give the correct answer i.e. even if the control exists, it returns false. Thanks

    reman

    Visual Basic help tutorial question

  • Is it possible to create controls from a new thread in a multithreading windows form application
    A Amer Rehman 0

    Hi Here is the code that I'm working on. Imports System.Threading Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click             tcpSend = New TcpSender             Dim trSend As New Thread(AddressOf tcpSend.RetrieveData)             trSend.Name = "Data Receiver"             tcpSend.Command = "Send data"             tcpSend.SysName = "Cabin1"             tcpSend.Port = 100             trSend.Start()             End Sub Imports System.net Imports System.Net.Sockets Imports System.IO Public Class TcpSender       Public Event SystemReplied(ByVal data As String)       Public Command, SysName As String, Port As Int16       Public Sub RetrieveData()             Try                   Dim tcpCli As New TcpClient(SysName, Port)                   Dim ns As NetworkStream = tcpCli.GetStream                   Dim sw As New StreamWriter(ns)                   Dim sr As New StreamReader(ns)                   ' Send data to the client.                   sw.WriteLine(Command)                   sw.Flush()                   ' Receive and display the response.                   If Command = "Send data" Then                         Dim strResult As String                         'read the first line                         strResult = sr.ReadLine &am

    Visual Basic csharp

  • Event raises but the required code does not?
    A Amer Rehman 0

    Hi I want to display the message in the following event procidure when a message is received by creating a control dynamically e.g. textbox to display the message. But the control is not created even after the event raises. Where is the bug in my code? Private Sub MessageReceivedEventHandler(ByVal data As String) Handles remote.MessageReceived Dim txt As New TextBox txt.Size = New Size(55, 25) txt.Location = New Point(x, y) txt.Name = "txtServer" txt.Text = data Controls.Add(txt) End Sub Thanks

    reman

    Visual Basic help question

  • Where is the problem
    A Amer Rehman 0

    Hi I want to display the message in the following event procidure when a message is received by creating a control dynamically e.g. textbox to display the message. But the control is not created. Where is the bug in my code. Private Sub MessageReceivedEventHandler(ByVal data As String) Handles remote.MessageReceived Dim txt As New TextBox txt.Size = New Size(55, 25) txt.Location = New Point(x, y) txt.Name = "strServer" txt.Text = data Controls.Add(txt) End Sub Thanks

    reman

    Visual Basic help

  • How to ping every computer in a LAN
    A Amer Rehman 0

    Hi I am using visual studio 2003. I need to ping every computers in my LAN for my application. For this purpose I have used the "System.Net" namespace's TCP class. Is there any better solution to this problem. Thanks.

    reman

    Visual Basic csharp visual-studio help tutorial

  • Where is the bug?
    A Amer Rehman 0

    Dear Mr. Alan After replying your first mail, I checked the code and found that I was maistaken. I did'nt check the Vb Documentation before writing code.Perhaps the solution to my problem is by using some API call. There is no managed way in VB 2003 to get all the open window. Or if there is, I'm not aware of it. And I'm using IE version 6. Thanks Amer

    reman

    Visual Basic help csharp question announcement

  • Where is the bug?
    A Amer Rehman 0

    Thanks for reply, but I am sorry to say that you are wrong. First, what do I want? I want to prevent user from downloading other than the mail pages(Yahoo, Gmail,Hotmail). Process.GetProcessesByName("iexplore") returns an array of processes whose Title we can retrieve in this way pr(i).GetMainWindowTitle. If we change the argument "i" we can retrieve all the open windows of IE though the process type is one ("iexplore"). What does the application do? It gives wrong answers.i.e. if the mail page is open first, it says "True", but if it is opened after opening another IE page, it says "False" despite the fact that it is open.

    reman

    Visual Basic help csharp question announcement

  • Where is the bug?
    A Amer Rehman 0

    Hi I have formulated a function that checks the titles of the IE pages open and if required page is found, takes the appropriate action (in this code snippet, just tells by message box) The problem is function does not do the required job. Where is the bug? Any help would be appriciated. Thanks (vb.net version 2003) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strNames() As String = {"Yahoo", "Gmail", "Hotmail"} Dim bln As Boolean = FindWindow(strNames) MsgBox(bln.ToString) End Sub Private Function FindWindow(ByVal Names() As String) As Boolean Dim pr As Process() = Process.GetProcessesByName("iexplore") If pr.Length > 0 Then For i As Integer = 0 To UBound(pr) For j As Integer = 0 To UBound(Names) If pr(i).MainWindowTitle.IndexOf(Names(j)) <> -1 Then Return True Exit Function End If Next j Next i End If End Function reman

    Visual Basic help csharp question announcement

  • How to prevent user from changing wallpaper in XP
    A Amer Rehman 0

    Hi Can anybody tell me how can I - as a system adminsitrator - prevent the limited users from changing wallpaper in windows XP without turning on active desktop. Since it has severe negative impact on performance. Thanks.

    reman

    System Admin performance tutorial question

  • How to get the no of records in random acccess files
    A Amer Rehman 0

    Hi Is there any direct way to get the number of records in random access files except by calculating the length of file and then dividing it by the length of each record. (Visual Studio 2003) Thanks

    reman

    Visual Basic csharp visual-studio tutorial lounge

  • How to set font size of a control dynamically
    A Amer Rehman 0

    Hi How can I set the font size of a control dynamically e.g. label. The problem is that the font size property is readonly. Thanks

    reman

    Visual Basic help tutorial question

  • How to restart a thread with new parameters
    A Amer Rehman 0

    Hi, Can anyone tell me the solution to this problem. I have built a procidure wrapped in a class that takes a parameter.This procidure is called normally by starting a thread. When an event occures, it is required to call the procidure with new paramater. A code snippet would be like this. Private Sub btnReceive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReceive.Click remote = New RemoteConnection 'this is the class trListen1 = New Thread(AddressOf remote.ReceiveMessage) remote.msg = "Message has been received." trListen1.Start() End Sub Private Sub btnChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChange.Click If trListen1.IsAlive = True Then trListen1.Abort() Else remote = New RemoteConnection trListen2 = New Thread(AddressOf remote.ReceiveMessage) remote.msg = "Message has been received,answer is here." trListen2.Start() End If End Sub But this does not work. How this can be handled? Thanks. reman

    Visual Basic help tutorial question

  • How to call a procidure requiring arguments with new thread
    A Amer Rehman 0

    Hi Can anybody tell me how can I call a procidure requiring arguments with a new thread. e.g. a code snippet like this. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim trShow As New Thread(AddressOf ShowMessage) 'error End Sub Sub ShowMessage(ByVal message As String) MsgBox(message) End Sub Thanks for replying for a hobbyist progarmmer. reman

    Visual Basic help tutorial question

  • AddressOf with arguments
    A Amer Rehman 0

    Hi When I use the "AddressOf" operand to call a procidure that requires some arguments, error occurs. How can I handle this problem. Error is "AddressOf operand must be the name of a method, no parentheses are required. Code snippet is below. Dim trThread As New Thread(AddressOf DoSomething(Arguments)) Sub DoSomething(Arguments) 'do something whatever it be End Sub Thanks reman

    Visual Basic help question

  • How to perform different actions with one handler
    A Amer Rehman 0

    Hi Please tell me in some lines of code.How can I perform differnt actions for controls that I have created at runtime.e.g. display the name of control. Code snippet is Dim x, y As Integer For i As Integer = 1 To 10 y += 25 btn = New Button btn.Location = New Point(x, y + 25) btn.Size = New Size(70, 25) btn.Name = "Button" & i.ToString btn.Text = "Button" & i.ToString Controls.Add(btn) AddHandler btn.Click, AddressOf btn_Click Next i Private Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Display the control name that was clicked End Sub reman

    Visual Basic tutorial question

  • How associate different event handler at runtime
    A Amer Rehman 0

    Hi Can anybody tell me how can I associate different event handlers for an array of controls that I have created dynamically. Suppose I create ten buttons at runtime. I want that every button perform differnt action e.g. give a message of such type. "You clicked" & (Button.Name) How this can be done. Thanks

    reman

    Visual Basic data-structures question

  • How to restrict user from closing an application
    A Amer Rehman 0

    Hi Can anybody tell me how to restrict user from closing an application. The scenario is, I have developed a time controller/recorder for users. Input form displays in the startup. User sets time on it and then it goes to systray and after the set time has passed, it shutsdown the system after givia warning or, if user wishes to do so, allows him to start another session. I have removed the control box but the problem is that the user can still close it with Alt + F4 Command. Thanks How this can be handled?

    reman

    System Admin help tutorial question

  • How to hide the startup form
    A Amer Rehman 0

    Can anybody tell me how to make the startup form invisible. The following code snippet in the included MSDN help displays the form for a while and then the form is closed automatically. ' Visual Basic Sub Main() ' Instantiate a new instance of Form1. Dim f1 as New Form1() ' Display a messagebox. This shows the application is running, ' yet there is nothing shown to the user. This is the point at ' which you customize your form. System.Windows.Forms.MessageBox.Show( _ "The application is running now, but no forms have been shown.") ' Customize the form. f1.Text = "Running Form" ' Show the instance of the form modally. f1.ShowDialog() End Sub

    reman

    Visual Basic help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups