Jump to content
Xtreme .Net Talk

Search the Community

Showing results for tags 'vb.net'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • New Member at Xtreme .Net Talk?
    • Meet and Greet
    • Announcements
  • .NET
    • General
    • Windows Forms
    • ASP.NET
    • Directory / File IO / Registry
    • Database / XML / Reporting
    • Network
    • Graphics and Multimedia
    • Interoperation / Office Integration
    • Deployment
    • Regular Expressions
    • Syntax Specific
  • Knowledge Base
    • Tutors Corner
    • Code Library
    • Quick Tips
  • Xtreme .Net Talk Members Area
    • Water Cooler
    • Suggestions, Bugs, and Comments

Blogs

There are no results to display.

Categories

  • Code Samples
  • Tutorials & Guides
  • Articles
  • Code Downloads

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Location


Occupation


Visual Studio .NET Version


.NET Preferred Language


Skype


Facebook


Twitter ( X )

Found 15 results

  1. Hi again :P In my musical project, I'm creating buttons and labels at runtime. I was wondering how can I make changes to a certain button object via a label object, like this: Dim Label1 as New Label Dim Button1 as New Button Me.Controls.Add(Label1) Me.Controls.Add(Button1) AddHandler Label1.MouseEnter, AddressOf MousyEnter Private Sub MousyEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) ' This is what I want to do: "Button1".Text= "What's up!" ' Can I access Button1 within Me.Controls? End Sub I cannot seem to figure this out. Any suggestions please let me know! Thanks!!!
  2. Hey guys! I'm using VB.net and I would want to have "property properties" of a class like this: Thing.Property1 = "Yo!" (*1) Thing.Property1.AnotherThing = 0 Thing.Property1.AnotherThing2 = True I understand I can use 'property Property1 as class' but if I do that, Property1 must get or set a Class, not a variable (*1) which is what I want. The contextualized example would be something like this: Music.Note = 32 (A number representing a musical note) Music.Note.MIDINumber (Retrieve the MIDINumber of Note) Music.Note.Name (Retrieve the name of Note) You can see it in this case: Textbox1.Text="Something" Textbox1.Text.Length ...Well, thanks for your help! :D
  3. I have an annoying problem. I have tried everything I could think of and anything google gave me and nothing is working. I have a form in a split panel. It contains panels and the panels contain the labels and text boxes. I carefully resize and move the text boxes and labels, save. When I open the form again or run the application the panels and textboxes has resized iteself to be squished up and moved some of the labels underneath the text boxes. This is driving me insane. Please help.
  4. As an intern I was given a project to go through to try and understand the developer's code, and I've run into a problem: I have two combo boxes that is populated from sql tables. The only problem is that if nothing is selected (which is possible), I get NullReferenceError: Object variable or With block variable not set. I want to add an extra item to the combo box which says something like: "Please select", this will be displayed when no item is selected. Here is some of the developers code: suburb.DataSource = DB.ReturnDataTable("Select ID,Suburb + ' - ' + City as Info1, Suburb as Info from tblG2O_PostalInfo order by Suburb") suburb.DisplayMember = "Info" suburb.ValueMember = "ID" That is where the suburb combo box is populated. ^^ (DB.ReturnTable is a custom method in a vb page, here is the code of that method: Public Function ReturnDataTable(ByVal sSQL As String) As DataTable Try Dim oConn As New OleDbConnection(DB_DSN) Dim retData As New DataTable Dim oRS As OleDbDataReader Dim oCmd As New OleDbCommand(sSQL, oConn) oConn.Open() oRS = oCmd.ExecuteReader() If oRS.HasRows = True Then retData.Load(oRS) End If oRS.Close() oRS = Nothing oConn.Close() Return retData Catch ex As Exception Trace("ReturnDataTable Error: " & sSQL & "<br>" & ex.Message) Return New DataTable End Try End Function ) Dim strsuburb As String = Trim(suburbc.SelectedItem("Info").ToString()) And that is where the selected suburb is assigned to a string. This string is used to update an existing table. This is the line where I'm having trouble. I have tried: suburbc.Items.Insert(0, "*Please select*") After the databind, but then I get a completely different error and if I do it before the databind, it's just overridden. I've also tried using statements to check if the value returned is Null, but I studied in C# and Java, and am quite new to VB and the ways I've tried to do this haven't worked. My current employer prefers us all to work in VB. Any solutions, tips or ideas will help. Thank you. =)
  5. hey its mike... thanks in advanced... im trying to make a program that will inter act with a wifi car... i have it done in vb6 and am trying to transfer it to vb.net in 2010 express... here is the vb6 code vb 6.txt and this is what i have so far for the vb.net... my problem is the keystrokes on the arrow keys dont register vb 2010.txt thanks again for all your help if u need any more info ill give u what i can
  6. Hi I can't figure out why this is happening. The app throws a nullreferenceexception on Me.Controls.Add(tab(count)). Public tab As Tab() Public wb As WebBrowser() Public count As Integer = 0 Public Sub NewTab(ByVal url As String) Try wb(count) = New WebBrowser tab(count) = New Tab wb(count).Name = "wb" & count.ToString() wb(count).Location = New Point(0, 69) wb(count).Size = New Size(903, 517) wb(count).Navigate(url) tab(count).Name = "tab" & count.ToString() If (count > 1) Then tab(count).Size = tab(count - 1).Size If (count = 0) Then tab(count).Size = New Size(212, 32) If (count > 1) Then tab(count).Location = New Point(tab(count - 1).Location.X + 212, tab(count - 1).Location.Y) If (count = 0) Then tab(count).Location = New Point(120, 0) Me.Controls.Add(wb(count)) Me.Controls.Add(tab(count)) count = count + 1 Catch ex As Exception MessageBox.Show(ex.Message()) End Try End Sub tab() is the name of the array of the usercontrols which has just a label and 2 pictureboxes in it. I know what the error means just not sure why it's doing this. Any tips? Thanks
  7. Hello again... i am here again to disturb u!!!!!!!!! I have two projects made in vc++ & vb.net of visual studio 2005 now i a third project in vb that integrates above two. I HAVE SEARCHED GOOGLE and result is negative
  8. I dont know anything about .net and vb code is converted to vb.net!!! :-( this is code:: i made it as attachment as max limit of letters was exceeded any help appreciated.... :confused: upgrade issue.txt
  9. Note from moderator: Please use the and [code=visualbasic] tags and other formatting features to make your posts readable. Spelling and grammar help too.[/color] This is in class file [code=visualbasic]Imports Microsoft.VisualBasic Imports System.IO Imports System.Collections.Generic Public Class FileSrch '' File Search Options Public Enum FileSearchOptions YearFirst MonthFirst DateinExtension NormalFiles End Enum Public Shared Function GetSearchcriteria(ByVal DatetoSearchwith As Date, ByVal Filename As String, ByVal FileExtension As String, ByVal SearchOptions As FileSearchOptions) Select Case SearchOptions Case FileSearchOptions.YearFirst Return String.Format("{0}_{1:yyyyMMdd}{2}", Filename, DatetoSearchwith, FileExtension) Exit Select Case FileSearchOptions.MonthFirst Return String.Format("{0}_{1:yyyyMMdd}{2}", Filename, DatetoSearchwith, FileExtension) Exit Select Case FileSearchOptions.NormalFiles Return String.Format(Filename + FileExtension) Case FileSearchOptions.DateinExtension Dim ExtensionFormat As String = (Convert.ToInt32(DatetoSearchwith.ToString("mm")).ToString() & DatetoSearchwith.ToString("dd")) '' Month in Double Digit If DatetoSearchwith.Month > 9 Then ExtensionFormat = (DatetoSearchwith.ToString("mmm")(0) & DatetoSearchwith.ToString("dd")) End If Return String.Format("{0}.{1}", Filename, ExtensionFormat) Case Else Return String.Format("{0}.{1}", Filename, FileExtension) End Select End Function Public Shared Function GetFiles(ByVal RootDirectory As DirectoryInfo, ByVal Filename As String, ByVal FileExtension As String, ByVal DatetoSearchwith As Date) As List(Of FileInfo) Dim FiFiles As New List(Of FileInfo) For Each DateOption As FileSrch.FileSearchOptions In [Enum].GetValues(GetType(FileSrch.FileSearchOptions)) FiFiles.AddRange(RootDirectory.GetFiles(FileSrch.GetSearchcriteria(DatetoSearchwith, Filename, FileExtension, DateOption), SearchOption.AllDirectories)) Next Return FiFiles End Function End Class This in Button Click Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim FileName As String ' Dim fileName As String = txtextension.Text.Trim().Substring(0, txtextension.Text.Trim().IndexOf(".")) If txtextension.Text.Contains("_") Then FileName = txtextension.Text.Trim().Substring(0, txtextension.Text.Trim().IndexOf("_")) Else FileName = txtextension.Text.Trim().Substring(0, txtextension.Text.Trim().IndexOf(".")) End If Dim extensionToSearch As String = Path.GetExtension(txtextension.Text) 'Dim Directory As String = Path.GetDirectoryName(txtpath.Text.Trim()) Dim Directory As New DirectoryInfo(txtpath.Text.Trim()) 'Dim filess As String() = Directory.GetFiles(txtpath.Text, txtextension.Text, SearchOption.AllDirectories) 'For Each fiFile As String In filess ' Response.Write(fiFile & "</br>") 'Next Dim SearchedFiles As List(Of FileInfo) = FileSrch.GetFiles(Directory, fileName, extensionToSearch, Now.Date()) 'Dim searchedFiles As List(Of FileInfo) = GlobalStuff.GetFiles(directoryToSearch, "whateverfilename", extensionToSearch, DateTime.Now) If (SearchedFiles IsNot Nothing AndAlso SearchedFiles.Count > 0) Then For Each fi As FileInfo In SearchedFiles Response.Write(fi.Name & "</br>") Next Else Response.Write("No files found") End If End Sub Now,we need to address the following things in that to complete req, If I enter filename_mmddyyyy.txt it should fetch only files having current date in their name in mmddyyyy format.For eg. If I give test_mmddyyyy.txt in txtextension it should return only files with test_10222010.txt and not thee ones with yyyymmdd and all�Right now I am getting all the files created in the current date including the one with ordinary test.txt and also test_20101022.txt ��.And the third thing filename.mdd everything is getting passed correctly but it is not fetching the file ..Again test,test_20101022.txt everything comes.It shouldn�t be like that it should only fetch files with .mdd (current date)�.if we give so��Hope u got� I implemented the normalfiles as u can see above.But in that there is one extra thing we need to address it is if I give ????.???,it should fetch only files like ajay.txt,siva.txt and so on�it should match exactly with the question mark .but what I am getting now is if I give ????.??? in text box I am getting files like nks.txt,nk.tt also�..all lesser files are coming �..? Should match exactly with letters also in extension. Hope you got��If we address the above things then we are done. And please help me in this final step..we are almost done� In my above code i have two text boxes one for file path and other one for getting extension and also for gettting file names with diff search criteria.....What i do is i should implement file search which is like as mentioned below - it should search for all files if i enter *.*,only jpg if *.jpg, and files like nks.txt if i enter ???.???....... if i enter the filename alone without extn it should return me filenames that exist without extension in directories. the final thing is the date in filename where my file will be like filename_mmddyyyy.txt or filename_yyyymmdd.txt or filename.mdd.In first case it should return only files with current date in mmddyyyy format and txt extn....like taht....last case is mdd in extn...where if i enter filename.123,it sould get me files with jan 23(23 currnt date) and for months greater than 9 it is N for nov ,D for dec and so on.But in m,ytext box i will enter only file.mdd only .and also filename_mmddyyyy.jpg like that....
  10. Hi friends, I'm developing a software but a problem came up. I want to print paper of size 8 by 6 in. this is not a standard paper size in crystal report. Its a continuous paper. I want to define custom size through Vb.Net Please Help. :(
  11. Private Sub btnaddcart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddcart.Click Dim part As PartDescription = New PartDescription() part = CType(lbxItems.SelectedItem, PartDescription) Dim SItem As String Dim Updateqty As Boolean = False SItem = part.PartNumber MsgBox(SItem) For Each i As string In lstPart.Items If lstPart.SelectedItem.ToString = SItem Then Dim tempqty As Integer = Integer.Parse(lstQuantity.SelectedItem.Items.text) tempqty += 1 lstQuantity.SelectedItem.Items.text = tempqty.ToString Updateqty = True End If Next If Updateqty = False Then lstPart.Items.Add(part.PartNumber) lstDescripption.Items.Add(part.PartName) lstUCost.Items.Add(part.UnitPrice) lstQuantity.Items.Add("1") lstUCost.Text = (part.UnitPrice * 1).ToString() End If End Sub i have a bunch of listboxes one has the final item you select then press addtocart witch will take seprate parts of the string and add themm to the relevent listbox and have qty set to 1 what i want is if the same item is selected again is instead of making a dublicate is to increse the relevent qty in the qty listbox but i keep getting this error Public member 'Items' on type 'String' not found i know i could use a listview for this task instead but i wanted to do it with seprate listboxes any help would be appreciated thanks
  12. I use following code to send the email. Dim smtpCli As New SmtpClient . . . . smtpCli.EnableSsl = True smtpCli.Send(mailMsg) Now I want to use TLS while sending the email. How to do it in VB.NET
  13. Hello all, I am new to xtremedotnettalk and this is my first thread. I am trying to create a function in vb.net that sends a website header through a socket to the server and returns the response. This is my code. Public Function GetSiteResponse(ByVal IPEndpoint As IPEndPoint, ByVal client As Socket, ByVal header As String) As Byte() client.Connect(IPEndpoint) If client.Connected Then Dim sendbuffer As Byte() = Text.Encoding.ASCII.GetBytes(header) client.Send(sendbuffer, sendbuffer.Length, SocketFlags.None) Dim recievebytes As Byte() = New Byte() {} Do Dim recievebuffer(350) As Byte Dim bytesrecieved As Integer = client.Receive(recievebuffer, recievebuffer.Length, SocketFlags.None) Array.Resize(recievebytes, recievebytes.Length + bytesrecieved) Array.Copy(recievebuffer, 0, recievebytes, recievebytes.Length - bytesrecieved, bytesrecieved) If bytesrecieved < recievebuffer.Length Then Exit Do Loop Return recievebytes Else Return Nothing End If End Function The code doesnt recieve the entire server response. What am i doing wrong? Thanks in advance.
  14. Can someone convert this one line of code for me: perl -MWWW::Mechanize -e '$m = WWW::Mechanize->new; $_=shift; ($i) = /v=(.+)/; s/%(..)/chr(hex($1))/ge for (($u) = $m->get($_)->content =~ /l_map": .+(?:%2C)?5%7C(.+?)"/); print $i, "\n"; $m->get($u, ":content_file" => "$i.flv")'
  15. Keywords: VB.Net, AVI Compression, avifil32.dll Hello, I have been struggling for days now to write a VB.Net application which converts BMP Images to AVI. This program works just fine in VB but will not run in VB.Net. The problem lies with the conversion of VarPtr() in VB to some other means in VB.Net. The main problem begins when calling the avifil32.dll function AVISaveOptions Defined as follow: Public Declare Function AVISaveOptions Lib "avifil32.dll" (ByVal hWnd As Integer, ByVal uiFlags As Integer, ByVal nStreams As Integer, ByRef ppavi As Integer, ByRef ppOptions As Integer) As Integer 'TRUE if user pressed OK, False if cancel, or error if error This function wants to receive a pointer to a pointer to an AVI_COMPRESS_OPTIONS Structure. The problem is that with VB.Net we are working with managed memory and it seems this function wants a pointer to a pointer to unmanaged memory. It has been suggested to use the following algorithm in order to get the VarPtr within .Net: Public Function VarPtr(ByVal o As Object) As Integer Dim oGC As GCHandle = GCHandle.Alloc(o, GCHandleType.Pinned) Dim ret As Integer = oGC.AddrOfPinnedObject.ToInt32 oGC.Free() Return ret End Function I have attempted to use this method with no luck at all... I then came across another trick for allocating the memory of the AVI_COMPRESS_OPTIONS to unmanaged memory, and then passing a pointer to that memory location to the AVISaveOptions function. Once the function has completed I then read the memory location back in and I can get the updated valued from the AVISaveOptions call. Here is the code that accomplishes this for me: Dim opts As AVI_COMPRESS_OPTIONS '//Allocate enough memory on the global heap Dim lpB As IntPtr = Marshal.AllocHGlobal(Len(opts)) Dim source(11) As Integer ' 11 elements in AVI_COMPRESS_OPTIONS, all of type Integer Dim destination(11) As Integer source(0) = opts.fccType source(1) = opts.fccHandler source(2) = opts.dwKeyFrameEvery source(3) = opts.dwQuality source(4) = opts.dwBytesPerSecond source(5) = opts.dwFlags source(6) = opts.lpFormat source(7) = opts.cbFormat source(8) = opts.lpParms source(9) = opts.cbParms source(10) = opts.dwInterleaveEvery '//Copy the managed array to the un-managed pointer Marshal.Copy(source, 0, lpB, 11) 'Len(opts)) Dim pOpts As Integer pOpts = lpB.ToInt32() res = AVISaveOptions(Me.Handle.ToInt32, ICMF_CHOOSE_KEYFRAME Or ICMF_CHOOSE_DATARATE, 1, ps, pOpts) ' Get the data back out of unmanaged memory Marshal.Copy(lpB, destination, 0, 11) opts.fccType = destination(0) opts.fccHandler = destination(1) opts.dwKeyFrameEvery = destination(2) opts.dwQuality = destination(3) opts.dwBytesPerSecond = destination(4) opts.dwFlags = destination(5) opts.lpFormat = destination(6) opts.cbFormat = destination(7) opts.lpParms = destination(8) opts.cbParms = destination(9) opts.dwInterleaveEvery = destination(10) At this point my opts object has valid information after the user has chosen their AVI format to save as. Everything seems to be going ok at this point, the following code executes without error: res = AVIMakeCompressedStream(psCompressed, ps, opts, 0) I am still wondering if passing opts at this point is valid, have I updated the object properly to pass it into this function call? Then, once I try to call AVIStreamSetFormat the application fails with a return HRESULT which has a value of -2147205018 (AVIERR_BADPARAM ). Here is how I call that function: Dim B() As Byte = bmp.GetBitmapInfo() Dim iLength As Integer = B.Length '//Allocate enough memory on the global heap Dim lpB2 As IntPtr = Marshal.AllocHGlobal(iLength) '//Copy the managed array to the un-managed pointer Marshal.Copy(B, 0, lpB2, iLength) res = AVIStreamSetFormat(psCompressed, 0, lpB2.ToInt32(), iLength) This code fails totally when selecting the MPEG4 compression format, it seems to succeed with some other formats but the file is never written to with my calls to AVIStreamWrite. It would seem that the problem lies somehow with the opts.lpParms value which is created by the AVI dll since the code passes the AVIStreamSetFormat when this value is set to 0, and not otherwise. Just for completeness, here is how I call the AVIStreamWrite method: ' Now write out each video frame For i = 0 To listBoxImageList.Items.Count - 1 listBoxImageList.SelectedIndex = i bmp.CreateFromFile(listBoxImageList.Text) 'load the bitmap (ignore errors) ' bmp.PointerToBits uses the same technique as above with using the Marshal class to get a pointer the an unmanaged memory location holding the bitmap info. res = AVIStreamWrite(psCompressed, i, 1, bmp.PointerToBits, bmp.SizeImage, AVIIF_KEYFRAME, 0, 0) If (res <> AVIERR_OK) Then MsgBox("AVIStreamWrite failed.") Exit Function End If Next The Declared Functions are below: Public Declare Function AVIMakeCompressedStream Lib "avifil32.dll" (ByRef ppsCompressed As Integer, ByVal psSource As Integer, ByRef lpOptions As AVI_COMPRESS_OPTIONS, ByVal pclsidHandler As Integer) As Integer ' Public Declare Function AVIStreamSetFormat Lib "avifil32.dll" (ByVal pavi As Integer, ByVal lPos As Integer, ByRef lpFormat As Integer, ByVal cbFormat As Integer) As Integer Public Declare Function AVIStreamWrite Lib "avifil32.dll" (ByVal pavi As Integer, ByVal lStart As Integer, ByVal lSamples As Integer, ByVal lpBuffer As Integer, ByVal cbBuffer As Integer, ByVal dwFlags As Integer, ByRef plSampWritten As Integer, ByRef plBytesWritten As Integer) As Integer Can anyone help me out and tell me what I am doing wrong in my code. Unfortunately I am not a strong C++ programmer and am weak when it comes to pointers. Has anyone had success with writing bmp images to an AVI file after choosing a compression type in .NET? Any help would be greatly appreciated.
×
×
  • Create New...