Latest Programming Posts

You see where you did

Dim cmdUpdate As OleDbCommand
Dim cmdSearch As OleDbCommand
Dim cmdDelete As OleDbCommand

What you have done is define pointers to specific objects but you didn't actually create those objects. What you want is

Dim cmdUpdate As New OleDbCommand
Dim cmdSearch As New OleDbCommand
Dim cmdDelete As New OleDbCommand

This creates the objects.

 Imports System.Data.OleDb
 Imports System.Data

Public Class Form9
Dim cnnOLEDB As New OleDbConnection

Dim cmdUpdate As OleDbCommand
Dim cmdSearch As OleDbCommand
Dim cmdDelete As OleDbCommand

Dim strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=.\\DatabaseCSMS.accdb"

 Private Sub Form9_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    cnnOLEDB.ConnectionString = strConnectionString
    cnnOLEDB.Open()
End Sub
 Private Sub btnsea3_Click(sender As Object, e As EventArgs) Handles btnsea3.Click
    Dim vSearch As String = InputBox("Enter Employee Id to search the details:")
    If vSearch <> "" Then
        cmdSearch.CommandText = "SELECT * from Employee_Details WHERE Emp_Id = " & CInt(vSearch)
        cmdSearch.Connection = cnnOLEDB
        Dim rdrOLEDB As OleDbDataReader = cmdSearch.ExecuteReader
        If rdrOLEDB.Read = True Then
            cbeid1.Text = rdrOLEDB.Item(0).ToString
            txtepn2.Text = rdrOLEDB.Item(1).ToString
            txtadd3.Text = rdrOLEDB.Item(2).ToString
            txtphon4.Text = rdrOLEDB.Item(3).ToString
            dtpdobi5.Value = rdrOLEDB.Item(4).ToString
            txtapt6.Text = rdrOLEDB.Item(5).ToString
            dtpdte7.Value = rdrOLEDB.Item(6).ToString
            dtpdoa8.Value = rdrOLEDB.Item(7).ToString
            rdrOLEDB.Close()
            MsgBox("Record found")
            Exit Sub
        Else
            rdrOLEDB.Close()
            MsgBox("Record not found")
            Exit Sub
        End If
    Else
        MsgBox("Enter search value.")
        Exit Sub
    End If

End Sub

Cropping by creating a layer marks, photoshop and lightroom, cropping so that he has some flexibility with the way that he crops his images. Cropping can save photos from a crooked horizon or unwanted subjects in the frame but it can also be used to create new and interesting images. It's like combining two images in a layer so that one images appears to marks were use to create nearly everything you see inside the triangels. You canm use your own custom image as a mask for cropping by adding and overlay are using the cutter tranformation flag.

Click option to further define your search indeed. To search your data is a work sheet or in a entire or work borad within box, select sheet or work board,to search for data in raws or colums in the search box. Microsoft excel saves the formating options you define. If you search the work sheet for data again and cannot find characters you know to be there you may need to clear the formating options from the previous search.

If you are still not conviced weather or not coupons are what your are coupons deal relevant is to know what type of product service your customer with a flexible coupons system. The building and making money with a coupons or daily deal website to help although the internet is littered with saving sites if you can find your niche and provide a great service you can do well flexible to run.

xrjf 163

To get error line number I would enclose inside a try-catch.

I'd have to guess that cmdSearch is not defined. I suggest putting a breakpoint on that line then adding a watch on cmdSearch to see what's up. Please post the code where cmdSearch is defined and identify its scope. It is possible that you declared it without the New keyword which would give you a reference variable rather than an object instance.

Jagruti22 commented: Yes sir, I am posting the code where i declared cmdSearch . +0

It could be any of the objects you are trying to use but possibly have not defined. I can't say because you haven't included any definitions. Those objects may be defined elsewhere or they may not. Or they are defined elsewhere and are out of scope. Note that you haven't told us what line threw the error. Line 4 is blank so that isn't it. A common error is to declare a reference to an object instead of creating the object (omitting the New keyword).

Not sure why, but something seems uncomfortable about moving Cars around like that. I guess the code gets quite tangled?
How about just keeping a list of Cars, and having current location (instance of Lane or Intersection) as an instance member of Car?
My guess is that it would work well both for updating the model (updating the Car's current location) and displaying the Cars in their current position, with very little to worry about in terms of concurrency.
J.

Please tell what's wrong in this code.. I am using 3 DateTimePicker.. I think that line has some problem...Please Help..

Untitled.jpg

Well, you got me :D
I indeed have problems with roads and intersections, because in my app (traffic simulator) I can choose how the road system will look like - I have roads and array list with lanes in it and linked list with cars in every lane. Problem is that since I added intersections I must have done something to make the cars go where I want them to, so the solution was to remove car from lane linked list, add it to linked list in intersection and after that remove it from intersection linked list and add to correct list in lane in road on which the intersection is. The problem is that in the same time cars are being painted by draw function in other thread every 100 ms, so there is good chance the car that is drawn will be erased in the same time. For now I'm going to try with other class that will paint cars and will have second linkedlist, to which I will add only new cars, erase only cars outside of graphics window and do it I hope more secure. I hope it will work. Thanks for response.

You could synchronise drawing and modifying, but that would prevent them running concurrently and immediately halve the performance of the app and make the UI less responsive (not to mention the complexity and overhead of all that synch).

So if you just want to loop thru the list while drawing, despite the model updates happening concurrently...

either use a copy of the List to loop thru the contents:
for (car c : new ArrayList<Car>(cars)) {...

or use a CopyOnWriteArrayList

or use a ListIterator

... but maybe your problem is more complex - eg you are changing the roads and intersections... you can make each list safe individually, but it's harder to ensure that the two lists are consistent across threads. You need to provide more details if this may be the case.

ps: When you ask a question here it's normal to provide some feedback on the answers you get, so others looking for simlilar problems know whether the answer was useful. It's also good manners .

        "Error in Line 4- System.NullReferenceException: 'Object reference not set to an instance of    an object."

       Private Sub btnsearch3_Click(sender As Object, e As EventArgs) Handles btnsearch3.Click

        Dim vSearch As String = InputBox("Enter Employee Id to search the details:")

        If vSearch <> "" Then
          cmdSearch.CommandText = "SELECT * from Employee_Details WHERE Emp_Id =" & CInt(vSearch)
           cmdSearch.Connection = cnnOLEDB

       Dim rdrOLEDB As OleDbDataReader = cmdSearch.ExecuteReader

        If rdrOLEDB.Read = True Then
            txteid1.Text = rdrOLEDB.Item(0).ToString
            txtepn2.Text = rdrOLEDB.Item(1).ToString
            txtadd3.Text = rdrOLEDB.Item(2).ToString
            txtphon4.Text = rdrOLEDB.Item(3).ToString
            dtpdobirth5.Value = rdrOLEDB.Item(4).ToString
            txtapt6.Text = rdrOLEDB.Item(5).ToString
            dtpduty7.Value = rdrOLEDB.Item(6).ToString
            dtpdoa8.Value = rdrOLEDB.Item(7).ToString

            rdrOLEDB.Close()
            MsgBox("Record found")
            Exit Sub
        Else
            rdrOLEDB.Close()
            MsgBox("Record not found")
            Exit Sub
        End If
    Else
        MsgBox("Enter search value.")
        Exit Sub
    End If
xrjf 163

I am very happy that you could resolve the issue. Thanks.

It is possible to access localhost from another computer. Check below process,

1.Get the internal IP or Static IP of the server (Ex: 192.168.1.1)
2.Open XAMPP>apache>conf>httpd.conf file in notepad
3.Search for Listen 80
4.Above line would read like- #Listen 0.0.0.0:80 / 12.34.56.78:80
5.Change the IP address and replace it with the static IP
6.Save the httpd.conf file ensuring that the server is pointed to #Listen 192.168.1.1:80
7.In the application root config.php (db connection) replace localhost with IP address of the server

the same problem also appeared on my vertrigo, and in the CMD window i find mysqld.exe was using the 3306, that confused me, mysqld and mysql database have conflicts?

Hi, I have a problem, because I have a list, in which I'd like to be able to add and remove components, but in other thread I use components from this list. Is there a safe way to operate over this list? Would using synchronized functions (one for drawing, one for modifying help?

I'm trying to access a database that is hosted in a MAC localhost from my anroide device which are both connected to the same network. The connect both devices to the same network. You will need to connect with both devices to the same network, find the ip address of your computer for windows, and visiting control pannel or find the host name of your computet.

It works now, with your last code. Thank you.
Here is the image from the console.

Unbenannt.png

I'm having a webpage that loads inside an iframe. I added the base tag to load the images, styling and to make links work, after clicking on a link I'm getting the error "whatsmyip.com refused to connect". Adding target="name-of-iframe" to all links doesn't work.

HTML

 <html>
    <head>
    <script type="text/javascript" src="jquery-3.2.1.min.js"></script>
        <script>
            function getURL(url){
                document.getElementById('frame').src  = 'proxy.php?url='+encodeURIComponent(url);
            }
        </script>
    </head>
    <body>
        <button onclick="getURL( 'https://whatsmyip.com/')">Google</button>
        <iframe name="frame" id="frame" width="800" height="600" src=""></iframe>
    </body>
</html> 

PHP

    $page = get_page($_GET['url']);

    $page = str_replace("<head>","<head><base href=\"".$_GET['url']."\">",$page);

    echo str_replace("<a","<a target=\"frame\"",$page);

    function get_page($url){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url);

        $proxy = '14.207.72.213:8080';
        curl_setopt($ch, CURLOPT_PROXY, $proxy);

        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }

Since both Chrome and Opera use the same engine and changes happen there, you have to dig into your code.
I didn't but want to mention that I check out my code and two sites to see if there's any mention of troubles.
https://caniuse.com/ and https://validator.w3.org/

I can make a bet this may not work correctly. Long ago I had issues with VB6 and wrong answers. There were two causes.

  1. I forgot that a VB6 Integer was only 16 bits.
  2. There were patches made in VB6's SP6 and SP6a that corrected things.

Fast forward to today and I don't see these two apps working on Windows 10 or maybe others so it's a dead area to develop. I'm not surprised at all that it doesn't work.

You have asked similar same question twice or more before. Why ask again? I'm starting to think you are spamming for Mobirise?

xrjf 163

There should be no problem by name. Could you upload an image of the Console listing the name (option 2.) ? Use the snipping tool for that purpose.

rproffitt commented: I agree but I've seen folk go down this rabbit hole and the name wasn't in the data. +15

I wouldn't count on "G930" showing up. Maybe by vid and pid but by name, would not count on that. Also, why are you doing this? Your mention of a serial number has me worried you are looking for non-existant data.

Again, "Frankly I'd walk your post back a bit and tell where you are going with this. For example you seem to want it to show you "Logitech something" but that's not always in the data.

What you can see is in USBView at https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/usbview which has full source available for those that want to get into this.

But that's not what I'm asking or why I'm sharing here. I'd like to know what prompted you to go down this rabbit hole."

Can you clarify what do you need? What technologies are you associated with? Different plugins can be used for different projects. There is a rich selection of plug-ins in Visual Studio

Fernando_14 commented: Detailed reports, resource usage, VCS as rproffitt said... +0
xrjf 163

¿Are you entering the complete name? The select command is NOT case sensitive, but if you want to use the percent wildcard '%', the function would be then:

    Function Find_Device_By_Name(name As String) As Boolean
        Try
            ' See if the desired device shows up in the device manager. '
            Dim info As Management.ManagementObject
            Dim search As New System.Management.ManagementObjectSearcher(
                "SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%" + name + "%'")
            For Each info In search.Get()
                Dim devname As String = CType(info("Name"), String)
                Dim ID As String = CType(info("DeviceID"), String)
                Console.WriteLine("Device ID is: " + ID.ToString)
                Console.WriteLine("       name=" + devname)
            Next
            Return True ' Device(s) Found '
        Catch ex As Exception

        End Try
        'We did not find the device we were looking for '
        Return False
    End Function

If you look with the developer tools of your browser you can see in that jcrop example how it's made of. The dark area are a bunch of divs added dynamically with JS and it calculates the width and hight distances of the crop area. Anyway there's probably a lot going on behind the scenes to get the desired effect, so my question is why do you want to make this image cropper yourself?

ok, I only need the function "find_device_by_name".
I tried your console-version, after Question Devices name is "g930" nothing happens and it starts again with selection.
After this i tried it by changing it to my code with textbox and msgboxes to see where it is. So it doesn´t start with "For Each info..." and there is no exception too.

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
        'Console.Write("Device's name is?: ")
        Dim name As String = TextBox1.Text
        Find_Device_By_Name(name)
    End Sub

    Function Find_Device_By_Name(name As String) As Boolean
        Try
            MsgBox("1")
            ' See if the desired device shows up in the device manager. '
            Dim info As Management.ManagementObject
            Dim search As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE Name='" + name + "'")
            MsgBox("2")
            For Each info In search.Get()
                Dim ID As String = CType(info("DeviceID"), String)
                Label1.Text = "Device ID is: " + ID.ToString
                MsgBox("3")
                Return True ' Device has been Found '
                MsgBox("4")
            Next
        Catch ex As Exception
            MsgBox("5")
        End Try
        'We did not find the device we were looking for '
        Return False
    End Function
xrjf 163

BTW you may cast from one type to another by means of DirectCast() or CType().