Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all 26421 articles
Browse latest View live

VS 2010 Button within a Location to execute a code

0
0
I am getting and error where 80, 380 is and the Comma is getting a error it blatantly says ") expected"

Can someone tell me why it does this?



Code:

If e.KeyCode = Keys.Space And BtnSprite.Location = New Point(12, 330) <= (80, 380) Then
            MsgBox("Txt here")
        End If

Additional info: I wan it if the button sprite is within the location of 12, 330 and 8-, 380 to execute the msgbox. I was confused on how I can implicate between methods but there is none. There is Greater then and less then signs that do the trick.

VS 2008 uncheck items from checkedlistbox and remove from database

0
0
have a checklistbox in windows application and am able to select the data items from checklistbox which is populated from database.& able to save the checked items in a tablebut not able to uncheck the checked items & remove from the database. I don't wan to uncheck all the checked items

Currently i have code for inserting checked items which is in for loop as

Code:

For i As Integer = 0 To Me.CHK_PRDT.CheckedItems.Count - 1
But my issue is suppose initally the user check 5 checkbox items and saves it .
later the user chooses to deselect 2 items from the selected 5 items and update the table

So I needed the code for deleting the unckecked items

The code that I have is


Code:


For i As Integer = 0 To CHK_PRDT.Items.Count - 1
 
 If CHK_PRDT.CheckedItems.Item(i)("pid").ToString().Contains(CHK_PRDT.Items.Item(i)("pid")).ToString() = False Then

STR = "if exists(Select * from prdt_taken where pid=" & CInt(CHK_PRDT.Items.Item(i)("pid")) & " and cust_id=" & CInt(lblid.Text) & ")" _
& " delete from prdt_taken where pid=" & CInt(CHK_PRDT.Items.Item(i)("pid")) & " and cust_id=" & CInt(lblid.Text) & ""


............execute code using reader
 End If
next

i get error

Index was outside the bounds of the array.

VS 2010 Need Help - Command launchbutton .exe re-size window or hide

0
0
I was stumped so i came here and hoped someone would know how to do this. I believe this is probably very easy or maybe its not possible but nothing is impossible

The basic Setup is
I have my app that launches another .exe i was wondering if it is possible to set a window size that the .exe will run in or possibly hidden where you cant see it.

the dimensions i look to set are 300x45 Its a very small status textline.

VS 2010 ProcessStartInfo - How to launch a .exe process in the background

0
0
I need help on how to code a command button (buttonclick1) to launch a program in the background I attempted to try to using ProcessStartInfo with CreateNoWindow and WindowStyle. I think it's possible to do it I just don't have experience and attempted to Use it but it was a total failure. So any help would be great.

Updating a charts points during runtime

0
0
Hi guys,

Big thanks to everyone who has helped me over the past couple of weeks.

I am currently creating a line graph in one form using an array that I have stored in a module, the array is configured in another form. As a value is added to the array I would like the graph to recognize this and plot the new point.

To make this clearer, on a click event a number is stored in the array, that array is then used by the chart. The chart then plots the new point in front of the user.
Below is my code and in bold is how I am using my array with the chart.


Code:

        With RChart.ChartAreas(0)
            .AxisX.Minimum = 1

            .AxisX.Maximum = 10

            .AxisY.Minimum = 0

            .AxisY.Maximum = 30

            .AxisY.Interval = 10

            .AxisX.Title = "Samples"

            .AxisY.Title = "Range"

        End With

        RChart.Series("Range").MarkerStyle = MarkerStyle.Circle
        RChart.Series("Range").MarkerColor = Color.Black
        RChart.Series("Range").MarkerSize = 5
        RChart.Series("Range").ChartType = DataVisualization.Charting.SeriesChartType.Line
      RChart.Series("Range").Points.DataBindXY(pNumofSamples, pRange2)

So far I have tried:

Looping through the above code until the form is closed with application.doEvents() - this didn't work.
Calling a procedure that did the same as above, Setting a timer to iterate through the above code. For these I get the error "Enumeration already finished." Pointing to ----> RChart.Series("Range").Points.DataBindXY(pNumofSamples, pRange2)

I have also tried multi-threading, using Me.CheckForIllegalCrossThreadCalls = False.. This also failed. I have had a search across the forum and can't seem to find a solution. I have read a bit about delegates and this could be a possible solution, however I'm wondering if anyone knows where I am going wrong or a way to solve my problem?

Again, appreciate the help.

Cheers.

address verification

0
0
I want to build an application that can verify address that is on a .CSV file.

The file will contain columns like this:

firstname, lastname, address1, address2, city, state, zip, country

Once the application see that if the zip is less than 5 digit it will list it on a datagrid or listview.
Another, if address1 or address2 contain a certain word it will list it on a datagrid or listview.
Another, if address1 or address2 contain a certain word it will search for another word and if that word exist it will display it on a datagrid or listview.

Also, I want to be able to save the listview as an Excel file.



If anyone is willing to help me please email me at <Email Removed>



Thank you

VS 2008 probleme EF with vb.net

0
0
hello :)
i have a problem with my project. the error is always related to database.savechages()
the inner execption say that :
{ "New transaction is not allowed because there are other threads running in the session."}
i'am not using more than 1 connection. i always dipose the connection at the end of the active action
i can't figure out what is the problem
someone help me please

key down e.suppress key

0
0
i have a telephone number textbox that i have used the key down event to suppress any other keys besides 0-9 and the backspace key. i have a label beside it.
i want to display a message on lbltelephone when the user presses an alphabetic key that the textbox is for numbers only,and the message should disapper when the user inputs correct values...
currently i have

e.suppresskeypress=true
lbltelephone.text="no"

but the message does not disappear when user enters correct values and even if focus is lost

key down, suppress key problem

0
0
i have a telephone number textbox that i have used the key down event to suppress any other keys besides 0-9 and the backspace key. i have a label beside it.
i want to display a message on lbltelephone when the user presses an alphabetic key that the textbox is for numbers only,and the message should disapper when the user inputs correct values...
currently i have

e.suppresskeypress=true
lbltelephone.text="no"

Vbnet2012- pdf viewer control doesn't work, why?

0
0
Hi guys,

with my VB2008 ver I did some simple code that loads a pdf into a pdf viewer with "AxAcroPDF1" command and it worked fine, but with my VB NET 2012
it returns error ,why?
Does anyone have an example of opening a pdf file into this "AxAcroPDF1" command from a specific location in the computer? in VB NET 2012

thanks

Update Statement

0
0
Hi,

I have the following update statement which works fine..

Code:

query = "UPDATE dbo.TblChangeControlDet SET  UATComment=@UATComment, UATDate=@UATDate, UATApp=@UATApp  WHERE ChangeID=@ChangeID"
            cmdC = New SqlCommand(query, conn)

            cmdC.Parameters.AddWithValue("@UATComment", txtUAT.Text)
            cmdC.Parameters.AddWithValue("@UATDate", DateTime.Now)
            cmdC.Parameters.AddWithValue("@UATApp", chkUATApp.Checked.ToString)
            cmdC.Parameters.AddWithValue("@ChangeID", txtchangeID.Text)

            cmdC.ExecuteNonQuery()

The issue is - UATComment field is optional, therefore, the user can option to leave it blank and update.

Prior to the update the UATComment is set as NULL value on the database.

Incase, the user updates without inserting anything to txtUAT.Text then the field records an empty field i.e., NULL is replaced by empty field.

UATComment is of datatype Nvarchar(Max).


Can I anyway retain the NULL incase the field was left blank prior to the update?

Thank you

VS 2010 Listing win 2008 server system32 directory files

0
0
Hi,

I’ve written a VB app in VS2010 to list files in the windows\system32 directory on one of our 2008 R2 servers. At first glance, the output file list looks correct. Upon closer inspection its not showing an exe file that I have just copied into the directory. It seems that the directory is somehow being cached and that any attempts to view the directory pragmatically only shows what seems like a cached version. Using file explorer on the server shows the file I copied over.

For info I have full administrator access to the server in question

I’ve tried many ways of listing the files. Some examples are listed below


Console.WriteLine("Method 1")
Dim diTop As New DirectoryInfo("c:\windows\system32")
For Each xxx As FileInfo In diTop.GetFiles("*", SearchOption.TopDirectoryOnly)
Debug.Print(xxx.FullName)
Console.WriteLine(xxx.FullName)
Next


Console.WriteLine("Method 2")
For Each File As String In System.IO.Directory.GetFiles("c:\windows\system32")
Debug.Print(File.Trim)
Console.WriteLine(File.Trim)
Next


Console.WriteLine("Method 3")
Dim tst As ICollection(Of String) = Nothing
tst = My.Computer.FileSystem.GetFiles("c:\windows\system32", FileIO.SearchOption.SearchTopLevelOnly)
For Each itm As String In tst
Debug.Print(itm)
Console.WriteLine(itm)
Next

Regards
Karl.

VS 2005 Any body help me plz...

0
0
Hi every one, i am working in vb.net 2005 i have a little bit problem that:

Suppose exam table have 16 student exam result. i have to assign top 10 positions to each student
note: if multiple students have same result then position will be set same.

My question is that how i code for position to each student

Attachment 93459
Attached Images
 

help please

0
0
i am developing an application to calculate and grade students' marks in schools exams with vb 2010. i find it practically difficult to create a file extension for this program. i want the program to be able to save the work in its own format. what should i do? please help me out.

VS 2005 Anchor and Dock properties quit working

0
0
In one form of a certain app the Dock and Anchor properties have just seemed to quit working when the app is run (in the IDE they work fine). This is an existing app that was working fine before. I've had to go in and make some enhancements/changes and now when I run the app and resize the form, the position and size of the controls remains fixed. I've also got a StatusStrip docked to the bottom of the form and it doesn't stay docked when I resize the form. This issue is happening for this one form only. The other forms in the app work correctly. I did have code in the Form Resize event to handle the positioning of the controls but when I noticed the problem, I commented out the Resize Sub, and set the Anchor properties of a couple of controls, just to see if they would work. They didn't. So, does anybody know what could cause all the controls on a form to lose their dock/anchor functionality all at the same time?

How to Cycle through Listview entries programmatically.

0
0
Hello guys.
I would be very grateful for your assistance. I want to know whether there is any means to cycle selection of entries in a Listview,
like as its done in a listbox such as the example below.
I need a listview equivalent to the Listbox sample as shown below.
Thank you all in advance.


LISTBOX ENTRY CYCLING SAMPLES:

Code:

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        With ListBox1
            .Items.Add("AAAAAAAAA")
            .Items.Add("BBBBBBBBB")
            .Items.Add("CCCCCCCCC")
            .Items.Add("DDDDDDDDD")
        End With
    End Sub

    Private Sub cmdUp_Click(sender As System.Object, e As System.EventArgs) Handles cmdUp.Click
        Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
    End Sub

    Private Sub cmdDown_Click(sender As System.Object, e As System.EventArgs) Handles cmdDown.Click
        Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex - 1
    End Sub

VS 2010 [RESOLVED] Select x random items from a listbox and add em in an array?

0
0
Hello VBForums,

So I have a listbox that has many items in it and I want to select x number of random items and add them in a string array.
Any solution with code or how would it work? I can't think straight at the moment cause I've been up for 30 hours. :sick:

To get more clear - x is not random it's a constant, the selected items have to be random. The listbox contains more items than x.

VS 2010 Read datatable column value

0
0
Hi,
I'm new in VB. I do have a datatable with a few columns. The first column having a unique values. How do I want read the particular column value and display it in textbox?

Say the datatable dt
Code:

ColumnA  ColumnB  ColumnC    ColumnD
AB          123x      456y      789z
CD          123y      456y      789x
EF          234x      567x        789z

The ColumnA input is based on user input from textbox2. So I make it as variable let say "varA". So how I want to check what's the value for ColumnC based on variable from ColumnA and display it to textbox3?

What I do have now:
Code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim varA As String
        varA = TextBox2.Text
        If dt.Rows.Contains(varA) Then
          TextBox3.Text = dt.Rows.Item(2)("ColumnC").ToString '--> this is not work because I need the value based on the varA input by user. Please advice what should do here.
        Else
            MsgBox("No ColumnA value found", MsgBoxStyle.Critical)
        End If
    End Sub

Can somebody advice? Thanks in advance.

add label text with formatting in pdf

0
0
hey all, i have a label with some text.the font of text is COLONNA MT, text color is dark green & size 32.
can i get the text with same formatting in my pdf ?
thanx in advance :)

VS 2010 DotNetZip UnZip/Zip with file locations

0
0
I've got the problem narrowed down, I just don't know how to fix it.

Here is an example code-

Variables for example:
Code:

Dim Username As String = Environment.UserName
    Dim AppData As String = "C:\Users\" & Username & "\AppData\Roaming"

Zip and UnZip subs:
Code:

Public Sub MyZip(ByVal ContentFolder As String, ByVal CreateZip As String)
        Using zip As ZipFile = New ZipFile()
            zip.AddDirectory(ContentFolder)
            zip.Save(CreateZip)
        End Using
    End Sub

Code:

Public Sub MyExtract(ByVal ZipToUnpack As String, ByVal UnpackDirectory As String)
        Using zip As ZipFile = ZipFile.Read(ZipToUnpack)
            Dim e As ZipEntry
            For Each e In zip
                e.Extract(UnpackDirectory, ExtractExistingFileAction.OverwriteSilently)
            Next
        End Using
    End Sub

How I call the subs:
Code:

MyExtract(AppData & "\test.zip", AppData & "\testdirectory")

MyZip(AppData & "\testdirectory", AppData & "\test.zip")

All this works fine, but the problem is that DotNetZip will not take file locations in this form. I get this weird "FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\.\" in the path." error. If I just put the zip and folder names (instead of locations + names) it works fine but only looks in it's local directory. How do I get it to function as I need it to?
Viewing all 26421 articles
Browse latest View live




Latest Images