Quantcast
Channel: VBForums
Viewing all 42132 articles
Browse latest View live

How to recover the deleted records from the MS SQLServer2008 log file?

$
0
0
The data in my SQLServer2008 was accidentally deleted, and I wanted to recover the deleted records from the log file. I found a link:

https://raresql.com/2011/10/22/how-t...rom-sql-sever/

However, the store-procedure in this link can't be executed. Is there any good method or tool to view and recover the deleted records? Thanks in advance.

VS 2013 Garbage collecting images

$
0
0
Hey all,
Curiosity runs wild.

Suppose I have this code...
VB.net Code:
  1. Do
  2.             Static count As Integer = 0
  3.             Me.PictureBox1.Image = New Bitmap(5000, 5000)
  4.             count += 1
  5.             Debug.Print(count)
  6.             'breathe
  7.             Threading.Thread.Sleep(10000)
  8.         Loop
When I run this and watch memory consumption in the task manager, memory for the app continuously increases until I finally get an ArgumentException from System.Drawing.dll after 14 iterations.

If however I add a GC.Collect to the code, memory stays in check and it will continue to run...
vb.net Code:
  1. Do
  2.             Static count As Integer = 0
  3.             Me.PictureBox1.Image = New Bitmap(5000, 5000)
  4.             GC.Collect()' <---- Adding this allows the loop to run indefinitely
  5.             count += 1
  6.             Debug.Print(count)
  7.             'breathe
  8.             Threading.Thread.Sleep(10000)
  9.         Loop
It was my understanding the the CLR will collect the garbage as needed, so what gives? Why do I need to manually collect garbage for this to work?

VS 2010 Reading Numbers In an Array and evaluating them against a number in a column

$
0
0
Hello All,
I am working on a small program that gets it data from a SQL database. My program is using Stored Procedures and reading the database every so many seconds. If it finds a row with a matching ID the data is displayed into a listview with a data reader. The issue is every time the procedure runs it pulls in the same row until that row is deleted by another program. The row contains a unique # and I get this number out of the data reader and place it in an array. I know the numbers are going in the array because I display them in another text box just to make sure, I need to compare the unique # and tell the program to just skip that row if it has already been placed in my listview. I have the number going into the array on a new line each time a new number is added. Most of the time there will only be one number but it could be up to 5-6 that it has to read and evaluate. I guess my question is should this be done in the SQL procedures or in the program code? Hopefully it makes sense. Thanks in advance.

Matt

[RESOLVED] Problem with DataTable Updating a Combobox

$
0
0
Hi

I have a combobox which is used as a filter its updated in real time as the user types and works fine but i had a problem when populating the initial datatable that holds all the items that are filtered into the combobox via a BindingSource.

What i 'Was' doing was looping through a DataTable and adding rows to the DataTable that was used with the combobox but the AddRow method was simply to slow and took 30-60 seconds just for a few hundred rows...

So i decided to try and use the .Select method to pull the results instead of looping the original DataTable and dump the results into the DataTable used on the combobox.

This method seems to be failing for some reason and i can see the results in the DataTable but the BindingSource doesnt reflect the new results and in fact still shows some old results which is strange to me.

so the Setup is this

DataTable1 holds the data im collecting for the filter
DataTable2 holds the collected data
BindingSource1 is between DataTable2 and the Combobox used to provide realtime filtering

this all works fine when i use the loop but doesnt when i used the DataTable.Select method...

Any Ideas?



Additional Info:

This is the code im using instead of the loop
--DT_Feedyard is what holds the data used for the combobox
--DT is the table i get the data from
--FiterBinder is the BindingSource

the objects and controls are already bound just in case your wandering :D

Code:

DT_Feedyard = DT.Select("[Type] IN ('P', 'L', 'M') AND [FYID] IS NOT NULL").CopyToDataTable

'refresh the combobox list
FilterBinder_Feedyard.ResetBindings(False)

i checked the tables using the DataTableViewer and all the data is there, but the BindingSource doesnt seem to get the data.

MsOf10 WORD VBA to create block text

$
0
0
I have reached an impasse with my limited VBA skills and ask if anybody can figure out this task. :rolleyes:

Simply stated, I need to remove all formatting from copied and pasted text into a new document, and to have all text be in one big block of text . If there are text boxes that can be deleted and text copied into the body of the text that would be fantastic -- I also need paragraph spacing to be removed and appended to the end of the previous line of text. I have attached photos of what I need below. It isn't too pertinent that the text be the same format, but if possible to make it 12pt and non-bold italics or underlined that would be fantastic.

I can't seem to get it all to work and I find myself just doing it the hard way anyways. :eek: Any help is appreciated, and thank you in advance. :thumb:

What it looks like upon copy paste:

Name:  Sample 1.jpg
Views: 33
Size:  44.9 KB

What I need it to look like after running Macro:

Name:  Sample 2.jpg
Views: 21
Size:  49.2 KB
Attached Images
  

VS 2017 Application Security Concerns

$
0
0
Hi

I have an Application that pretty straight forward albeit large and its basically used to track a business, stocks, deals etc etc and at the moment My Client is using along with some of his clients to track various business (i guess). it does not deal with financial transactions (for now) and is purely used for tracking internal things.

Basically up until now My client didnt want to waste time on security or logins or anything like that so i just basically hard coded certain things to make it work (logins for the DB etc) i know this is a bad idea really but that swhat he wanted :D.

the project settings has a whole host of things in it like login details, queries, SP names and SP variable names etc and im just connecting using standard methods to the DB (which is Azure).

So what i think i wanted to know was, Is this really bad??

This app is not online and is usually handed through email or personally to just a few people so for an undesirable person to get a hold of it is unlikely but possible.

The app controls all the data going through the DB except transactions and tracks alot of money (millions)

makes you wonder why my client isnt interested in more security :D

what are your thoughts?

and is it easy just to secure the file a little ?

Set focus to next TabIndex

$
0
0
Hello, in an UserControl that is a control container, I want to send the focus next control outside the UserControl (or previous one).

I found that in .Net there is a function SelectNextControl that I think does that (just for reference).

How can I do that in VB6?
I can get what controls have their windows with WS_TABSTOP style, but I don't know how to get their TabIndex with API.

I made some code that navigates the child windows and it seemed to work, but then I realized that it gets the next (or previous) window in the Z-Order and not in the TabIndex.

Here is that code (just for reference):
Code:

Private Sub SetFocusToNextControl(nForward As Boolean)
    Dim iHwnd As Long
    Dim iFb As Boolean
    Dim iGW_N As Long
    Dim iGW_F As Long
   
    If nForward Then
        iGW_N = GW_HWNDPREV
        iGW_F = GW_HWNDLAST
    Else
        iGW_N = GW_HWNDNEXT
        iGW_F = GW_HWNDFIRST
    End If
   
    iHwnd = mUserControlHwnd
    iHwnd = GetWindow(iHwnd, iGW_N)
   
    If iHwnd = 0 Then
        iHwnd = GetWindow(mUserControlHwnd, iGW_F)
        iFb = True
    End If
   
    If iHwnd <> 0 Then
        Do Until ((GetWindowLong(iHwnd, GWL_STYLE) And WS_TABSTOP) <> 0) And (IsWindowVisible(iHwnd) <> 0) And (IsWindowEnabled(iHwnd) <> 0)
            iHwnd = GetWindow(iHwnd, iGW_N)
            If iHwnd = 0 Then
                If iFb Then Exit Do
                iHwnd = GetWindow(mUserControlHwnd, iGW_F)
                iFb = True
            End If
        Loop
    End If
    If iHwnd <> 0 Then
        SetFocusAPI iHwnd
    End If
End Sub

I'm traying to do it with API, but if the TabIndex is not a property of the windows and just something that VB6 stores internally, I'll have to do it with the Parent.Controls collection.
But before going that route, I wanted to ask if someone knows how to do it.
Thanks.

Where to download Visual Studio 6.0 Installer for Windows 10?

$
0
0
Hi!

I was searching for Visual Studio 6.0 Installer for installing Visual Studio 6.0 under Windows 10.
I found page where is available link to download version 5.0 - but link is broken and all other sites referring to this site.
No other link I found!

Can anyone help me where to get it?

Thank you very much.
Miro

The document caused a serious error

$
0
0
I noticed that MS Office Word does not work very well with DOCX file. I have one document in which i have inserted various changes.
Bit now i am getting this error message: The document caused a serious error the last time it was opened. Would you like to continue opening it?

How can i remove the error or what should I do? Any suggestions ideas would be great.

BCM Compulsory field, New opportunity

$
0
0
Hello ..

I want to make a custom field compulsory in BCM/ Opportunity/New Opportunity , when ever someone is adding New opportunity , that custom field must also be filled. Can anyone please share some sample code ?

I have very little experience with VBA codes.

Thanks

searching in text to display data with checkbox resets over and over again why?

$
0
0
hey,
i have a listview with checkboxes that the user can choose.
i want to search in the text box and choose some data by clicking in the checkboxes
however
when i start the search and find the item,i click in the checkbox
and when i clear the textbox search the checkbox is unchecked.
how can i make a search and checkbox what ever i want and make
a new search but without clearing the checkbox i choosed before.
this is my code
Code:

    Dim Rs As New ADODB.Recordset
    Rs.Open "Select * From Inventory " & _
    " Where InvSupplier = '" & StrSuppliernameSearch & "'" & _
    " And InvItem LIKE '%" & RplS(TxtProductName.Text) & "%'" & _
    " Order By InvItem", CN
    LTreat.ListItems.clear
    Do While Not Rs.EOF
        Set itm = LTreat.ListItems.Add(, , Rs!InvItem)
        itm.SubItems(1) = FormatCurrency(Rs!InvBeforeTax)
        itm.SubItems(2) = FormatCurrency(Rs!InvForCust)
        itm.SubItems(3) = Rs!InvQuantity
        itm.SubItems(4) = FormatCurrency(Rs!InvPayments)
        itm.SubItems(5) = Rs!InvParts
        itm.SubItems(6) = Rs!Mahlakaid
    Rs.MoveNext
    Loop
    Rs.Close

tnx for any help
salsa:)

how to fill combo box by code

$
0
0
hello every one

the problem is in form 3 combo1

i have a problem in filling combo box by code (do while ) loop

if vn.recorcount = 0 then

msgbox " please add item"
me.hide
exit sub
end if

vn.movefirst
combo1.clear
do while not vn.EOF
combo1.additem ("vn_nm")
vn.movenext
loop

when i tried the code, the combo box was filled by vn_nm

i tried to upload the file but i couldn't because of invalid extension (.rar)

[RESOLVED] How to browse the combo listiiems?

$
0
0
Hello experts
I need to display the combo items in the combo text upward and backward.
That is to say Command 1 = from index 0 to 12 and command 2 = from index 12 to 0.
This is what I'm doing but I believe I'm too far from my objective.
Code:

Dim i As integer
For i = 0 To CboMonth.ListCount - 1
CboMonth.text= CboMonth.List(i)
Next i

thank you

Is it possible to create file with Application Icon

$
0
0
Hi,
Is it possible to crate file or a text file but with icon of the Application Icon.

Thanks in advance for the help.

[vb6] Resource Image Viewer/Extraction

$
0
0
A tool I developed to help with another project I'm working on. The tool worked well and decided to pretty it up and share it.

This is similar to your typical resource-hacker, but limited in scope to only resource images: icons, cursors, bitmaps, animated icons/cursors. You can view those that are contained in a binary (dll, exe, ocx, etc) and also contained in VB resource files (.res). Additionally, you can open a disk icon/cursor file for review.

There is an option to simulate DPI. This could be useful when you are viewing your own resource file and would like to see what your icons/cursors/bitmaps may look like if you declare your application DPI-aware.

The tool allows you to extract the viewed images to file. For icons/cursors that contain multiple images, you can individually select which are to be extracted and change the order they will appear in within the extracted file.

Also there is a filter option for image width, bit depth and whether icons/cursors include/exclude PNG-encoded images.

Tip: At top of the form, there is a m_AllowSubclassing boolean. Set this to false if you plan on walking through any code; otherwise, leave it to true. The subclassing occurs on three things:

1) The form itself to restrict minimal resizing
2,3) The picturebox and scrollbar to trap mouse wheel scrolling messages

Without the subclassing active, you can't use the mouse wheel for scrolling. The picturebox is coded for standard keyboard navigation.

Name:  ss.jpg
Views: 27
Size:  33.0 KB
Attached Images
 
Attached Files

VS 2013 Global KeyHook

$
0
0
Hello,

First of all, thank you for having me here.

I have this code:

Code:

    Private Sub MainForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown

        If (e.KeyCode And Not Keys.Modifiers) = Keys.L Then
        DF1Com1.Write("O:1/0", "1")  ' (O:9/0) (R) - Move Camera Up 
        End If 

    End Sub

    Private Sub MainForm_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp

        If (e.KeyCode And Not Keys.Modifiers) = Keys.T AndAlso e.Modifiers = Keys.Control Then
            DF1Com1.Write("O:1/0", "0")  ' (O:9/0) (R) - Move Camera Up 
        End If

    End Sub

Effectively then I press CTRL + T it does one thing
Code:

DF1Com1.Write("O:1/0", "1")
and the when I release CTRL +
Code:

T DF1Com1.Write("O:1/0", "0")
I have tried https://sim0n.wordpress.com/2009/03/...rd-hook-class/ However I cannot get it to work. The debugger console does indeed pick up the key strong when not focusing on the from.

Effectively. I want to be able to use CTRL + T (Keyup / Keydown) when the app is minimized. I know you can do this in C# however I need to do it in VB.NET

Thank you

VS 2010 Receive data from serial port then place on text box the data came from rfid tag

$
0
0
Good day, my project is vb.net using rfid which is MFRC522, my reader is arduino, i connected and receive data from serial successfully, but my problem is in every time i tap the id the pin of id will stack on the text box,and continuously add, i want that in every time that i tap the id the pin change or update,

This is my code

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
receivedData = ReceiveSerialData()
studtag.Text &= receivedData

time.Text = Now
timein.Text = TimeOfDay.ToString("h:mm:ss tt")
End Sub

Function ReceiveSerialData() As String
Dim Incoming As String
Try
Incoming = SerialPort1.ReadExisting()
If Incoming Is Nothing Then
Return "nothing" & vbCrLf

Else
Return Incoming

End If
Catch ex As TimeoutException
Return "Error: Serial Port read timed out."
End Try



End Function
advance Thank you..

all replies are really much appreciated. I'm using VB.net 2010

VS 2010 [RESOLVED] Receive data from serial port then place on text box the data came from rfid tag

$
0
0
Good day, my project is vb.net using rfid which is MFRC522, my reader is arduino, i connected and receive data from serial successfully, but my problem is in every time i tap the id the pin of id will stack on the text box,and continuously add, i want that in every time that i tap the id the pin change or update,

This is my code

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
receivedData = ReceiveSerialData()
studtag.Text &= receivedData

time.Text = Now
timein.Text = TimeOfDay.ToString("h:mm:ss tt")
End Sub

Function ReceiveSerialData() As String
Dim Incoming As String
Try
Incoming = SerialPort1.ReadExisting()
If Incoming Is Nothing Then
Return "nothing" & vbCrLf

Else
Return Incoming

End If
Catch ex As TimeoutException
Return "Error: Serial Port read timed out."
End Try



End Function
advance Thank you..

all replies are really much appreciated. I'm using VB.net 2010

Custom Marquee ProgressBar?

$
0
0
Hi all,

I've managed to create custom block progressbars before in other projects:
Code:

Private Sub ProgressTimer1_Tick(sender As Object, e As EventArgs) Handles ProgressTimer1.Tick

        ProgressBar1.Increment(1)
        Picturebox2.Width = 319 * ProgressBar1.Value / 100
        Label2.Text = String.Format("{0}%", ((ProgressBar1.Value / ProgressBar1.Maximum) * 100).ToString("F2"))

        If ProgressBar1.Value = 100 Then

            ProgressTimer1.Stop()
            Panel2.Visible = False

        End If

    End Sub

However, I'd really like to make it so that a picturebox basically replicates the movement of a marquee progressbar by going left->right, left->right continuously.

How can I make this happen?
Thanks!

Information not saving to Database

$
0
0
Hi, I am a student and i am trying to create a Library Management system for my project. I have created a local database in visual studio 2015 to save information from the tables i have created. the database is (my sql server database file..MDF). I have created a connection string and a command string to save and execute queries on my database. I am having a trouble saving information to my customer Table. i have managed to get the information to save into my Booktable but can't get it to save in my customer table. For some odd reason the auto increment won't work for the user ID and i get a error stating the customer table does not accept null values for the column User ID. The user ID is a primary key and should not accept null values but the auto incrementer should generate a new number when adding a new record/row but it does not work.

So can you help me save the information into my customer table and help me solve the problem of getting my auto incrementer to work for the USER ID column.

Here is the code for my customer table
vb.net code:
Code:

Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class CustomerTable
    Dim cn As New SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='C:\Users\Eugen\Downloads\Library management System (lastestone)\Library management System (1)\Library management System\Library management System\Database1.mdf';Integrated Security=True")
    Dim cm As New SqlCommand
    Private Sub CustomerTableBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles CustomerTableBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.CustomerTableBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.BookTableSQL)

    End Sub

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'BookTableSQL.CustomerTable' table. You can move, or remove it, as needed.
        Me.CustomerTableTableAdapter.Fill(Me.BookTableSQL.CustomerTable)

    End Sub

    Private Sub AddButton_Click(sender As Object, e As EventArgs) Handles AddButton.Click
        cn.Open()
        cm.Connection = cn
        Me.Validate()
        Me.CustomerTableBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.BookTableSQL)
        Try
            CustomerTableBindingSource.AddNew()
            User_NameTextBox.Select()
            cm.CommandText = " insert into [dbo].[CustomerTable] INSERT INTO [dbo].[CustomerTable] ([Book ID], [User Name], [Check in date], [Chexk out date], [Copies], [Transactions]) VALUES ( '" & Book_IDTextBox.Text & "' , '" & User_NameTextBox.Text & "' , '" & Check_in_dateDateTimePicker.Value.Date & "' , '" & Chexk_out_dateDateTimePicker.Value.Date & "', '" & CopiesTextBox.Text & "', '" & TransactionsTextBox.Text & "'  )"
            cm.ExecuteNonQuery()
            cn.Close()
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub

couldn't find the tags for VB can you post it for me please
Attached Images
  
Viewing all 42132 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>