mercredi 6 mai 2015

Items not showing in listbox

I've got a simple list box on my VB form and I'm adding strings to it using the standard lstBox.items.add("string") command. However, the items aren't actually showing up in the list box. If I iterate through the items collection using:

For each item in lstBox.items
   msgbox(item)
next

It shows up just fine as part of the collection. It just isnt visible in the list box. If I add items to said collection before compilation, using the IDE, they show up fine and I can delete them in the normal way. I have tried deleting and re-adding it but that hasn't helped.

Quite frankly I am stumped, because I have used listboxes hundreds of times and I can't get this to work. So any help would be appreciated.

Thanks in advance

Javascript code cached in browser

I have a below inline Javascript code in my aspx page of asp.net web application.

 function Confirm_Popup(dealid) {
 var bVal
 bVal = confirm("Are you sure you want to assign the same deal again?");
 if (!bVal)
    window.location.href = "page.aspx?id=" + id;
else
    window.location.href = "page1.aspx?id=" + id; 
}

I am calling the code from code behind file like below.

ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "showalert", "Confirm_Popup('" & Id & "');", True)

Step 1: Open the the page link for the first time.

Step 2: Open the same link again in new tab.

Issue is I am getting confirm Pop up in Step 1 but Step 2 is not giving pop up. Requirement is to display pop up in step 1&2. It seems like code is cached by browser.

Kindly help.

Harder For Crackers

I'm writing my school work about software cracking (software piracy) and Im making example crackme application (in Visual Basic). Currently Im using these methods as crack protection: 1 - Application code is obfuscated and binary is packed. 2 - Application must run only from Launcher (if you run it directly error will appear) 3 - Launcher is obfuscated and packed too. 4 - License key (hash) is written in registry (encrypted by MD5) 5 - On start application download file with valid license keys and compare license key from registry with this file (if licensed key is not in file with valid keys application will crash) (after comparation is downloaded file deleted) 6 - On start application download file with license key expiration date and compare it with date from cumputer (after comparation is downloaded file deleted) I know it can not be completely protected from crackers (it will be cracked). Do you have other anti piracy tricks and tips? Thank you :)

Permit free scrolling in xceed grid vb.net

I use a GridControl in Xceed.Grid in vb.net.

In my grid, the rows' height are specified by some timespan information.

I would like to permit the user to scroll into this grid, but the problem is that every time you scroll once in the grid, you scroll until the beginning of the next row.

I would like to know if it's possible to scroll a definite height in the grid when you scroll with your mouse.

I search in the properties of the gridcontrol but I didn't manage to find any property that handle this problem.

VB.net if else convert to case select

hi guys can you help me to convert this to case select statement, this is my first time using case select statement.

If TabControl1.SelectedTab Is tp_5 Then
      myqry = "SELECT * FROM TBLVLAN5 ORDER BY ID"
ElseIf TabControl1.SelectedTab Is tp_7 Then
      myqry = "SELECT * FROM TBLVLAN7 ORDER BY ID"

i search in web but i only found case select statement using integer and string and not the one that fit with my if else example.

i also try use it but its not working, this is my code.

Dim h As String
    h = TabControl1.SelectedTab Is tp_10
    Select Case h
        Case TabControl1.SelectedTab Is tp_5
            myqry = "SELECT * FROM TBLVLAN5 ORDER BY ID"
        Case TabControl1.SelectedTab Is tp_7
            myqry = "SELECT * FROM TBLVLAN7 ORDER BY ID"
        Case TabControl1.SelectedTab Is tp_8
            myqry = "SELECT * FROM TBLVLAN8 ORDER BY ID"
    End Select

any help is greatly appreciated. thanks.

How to use a checkbox to change values in an SQL database in asp.net

I currently have system which has a web front end and a back office system. User can book properties online or call our office to book a property. In the admin system on the web front, I have two check boxes to determine if the property is available on the front end or the back office system. This is controlled using a Check box. The code for the check box is as follows;

<asp:CheckBox ID="CheckBoxAvailableToWeb" runat="server" TextAlign="Left" Text="Available for web bookings"
                                    Checked="true" />

I have an field in an SQL Database called "isAvailableToWeb" which has a Boolean result. What I want to achieve is if the check box is checked, the value of the "isAvailableToWeb" field is set to "True" or set to "False" if un-checked.

I have tried to complete this function using the following code;

 Protected Sub CheckBoxAvailableToWeb_CheckedChanged(sender As Object, e As EventArgs, ByVal beachhutid As Long)
    Using dbContext = New bbhasDBEntities
        Dim item
        item = (From i In dbContext.tblBeachHuts Where i.beachHutId = beachhutid Select i).First()
        If CheckBoxAvailableToWeb.Checked = True Then

            item.AvailableToWeb = True
        Else
            item.AvailableToWeb = False
        End If

        dbContext.tblBeachHuts.Attach(item)
        Call dbContext.SaveChanges()
    End Using
End Sub

This code doesn't throw up any errors but doesn't also make the change that I would like to see.

I have a button on this page that saves the information so I would also like to know if it would be better, once the code is working, to put it in that Sub.

Which events are raised when a form is showned after it was hiding (vb.net)

In my vb.net project, I navigate between forms. I have a main form in which I can display new forms and modify some information in them.

When I closed these new forms, the main form, previously hidden, is displayed by the form.show() method and should consider these modifications.

In order to do that I need to know which event(s) is(are) raised when a form is shown by the form.show() method.

I already try to use the form.show event but it is only raised when the form is firstly showned at the start.