646 Posted Topics
Re: Yes, there is EnumRoles function which returns a string collection. Here's an example [CODE=VB.NET]For Each RoleName As String In user.EnumRoles() Console.WriteLine(RoleName) Next[/CODE] HTH | |
Re: [QUOTE]this code is working, but i dont understand what is " RightToLeft rtl = Parse<RightToLeft>(rightToLeftText); RightToLeft rtl = Parse<RightToLeft>(rightToLeftText); and what it does?[/QUOTE] That's for dealing with languages (strings in C#) which are read from right to left. You can read more about [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.righttoleft.aspx"]RightToLeft property[/URL] from MSDN. [QUOTE]also i dont … | |
Re: This [ICODE]System.Threading.Thread.Sleep(100);[/ICODE] makes your code to wait for 100 ms. But it doesn't yield CPU time to other threads if that's what you want. Use [ICODE]Application.DoEvents();[/ICODE] to yield some CPU time to other threads as well. You may also use both together: [CODE=C#]Application.DoEvents(); System.Threading.Thread.Sleep(100);[/CODE] but I would try to avoid … | |
Re: I suggest using either [ICODE]Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)[/ICODE] for roaming profile, or [ICODE]Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)[/ICODE] for local profile to store any data. When you use file paths in this way, your application will work in any Windows version (from XP to Vista and 7). Also, you're not relying the user to have any specific drive … | |
Re: Forget the WMI :) .NET has System.DirectoryServices namespace that provides all the AD services you'll need. See the [URL="http://msdn.microsoft.com/en-us/library/system.directoryservices.aspx"]documentation in MSDN[/URL]. HTH | |
Re: You mean there's a progressbar that both form's can update? Yes, it's possible. Create a project with two forms (Form1 and Form2), drop a button to both forms (Button1) and a progressbar (ProgressBar1) to Form1. Paste the following code to Form1: [CODE=VB.NET] Public Sub SetupProgressBar(ByVal MinValue As Integer, ByVal MaxValue … | |
Re: I didn't quite get what's the problem. Your code (the latter Command1_Click) does count the user's age in months and years correctly. I tried that snippet with a birthdate "1-1-2000". The results are Text4.Text = "125" and Text5.Text = "10" which is correct. Am I missing some point in here … | |
Re: Yes. You have to yield CPU time to UI thread in order to keep its message pump working: [CODE=C#]for (int i = 0; i < 200; i++) { label1.Text = i.ToString(); label1.Refresh(); Application.DoEvents(); System.Threading.Thread.Sleep(10); }[/CODE] | |
Re: In your code TextBox1.Text & TextBox2.Text concatenates two strings. The resulting string will never be null or empty if either one of the textboxes is not null or not empty. [CODE=VB.NET] If String.IsNullOrEmpty(TextBox1.Text) OrElse String.IsNullOrEmpty(TextBox2.Text) Then Button1.Enabled = False Else Button1.Enabled = True End If[/CODE]You have to check those textboxes … | |
Re: Here's a really simple example to save/load a text box's text: [CODE=VB.NET] Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click ' Save a text box's text Dim FileName As String = "C:\test.txt" My.Computer.FileSystem.WriteAllText(FileName, TextBox1.Text, False) End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As … | |
Re: Trap the "main" webbrowser control's Navigating event to obtain the target url and to cancel the navigation in the "main" webbrowser. [CODE=VB.NET] ' Use this flag to indicate initial loading of the first web control Private _InitialLoad As Boolean Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles … | |
Re: You want to build a form's menu dynamically from the database, am I right? Here's an example how to create a menu dynamically. Menu creation happens when a button is clicked but should be done in some other way. [CODE=VB.NET] Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) … | |
Re: You can pass commandline arguments to WinForms apps: [CODE=VB.NET] Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' Dim Args() As String Args = Environment.CommandLine.Split(CChar(" ")) ' Split arguments (space separated) ' Args(0) is application's name If Args.Length > 1 Then ' Pass the image file's … | |
Re: [QUOTE]I'm thinking that the standard tooltip in c# can't do that since it looks like it just takes a unicode string. (Is that correct or is there some gucci way of getting around that?)[/QUOTE] Yes, just a plain text without formatting. AFAIK there's only two solutions. Get some third-party tooltip-control … | |
Re: Environment.GetFolderPath() -function gives you the correct path. Function parameter is one of the Environment.SpecialFolder -enumeration values. [CODE=VB.NET] Dim PathStr As String PathStr = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) ' Append "\" if missing If PathStr.Length > 0 AndAlso Not PathStr.EndsWith(Path.DirectorySeparatorChar) Then PathStr &= Path.DirectorySeparatorChar End If ' Append hard-coded subfolder and file name (or … | |
Re: You have a small error in for-loop (line 21). For-loop "loops" as long as the condition "j == values.Length - 1" is [B]true[/B]. In the first round you have condition 1 == 72 which is always false that's why you never execute the statement in the loop. Change the condition: … | |
Re: > I guess it also saves image because when I open pic_info > table from SQL SERVER 2000 it shows "System.Drawing.Bitmap" there in the pic field. No it didn't. It converted PictureBox.Image [U]object[/U] to a [U]string[/U] and saved the string "System.Drawing.Bitmap". Easiest way to handle System.Drawing.Bitmap type is to convert … | |
Re: Yes, that's a language specific thing. And you have to make yourself clear weather logical expressions are short-circuited or fully evaluated. That is a one thing that causes some hard to track errors when porting an application from one language to another. VB.NET has also logical short-circuit operators, namely AndAlso … | |
Re: You should read the CSV file as a normal text file i.e. one line at the time. Now, when you have a line as a string, you can use string.Replace() method to remove multiple delimeters. [CODE=C#]string OneLine; StreamReader fReader = null; string[] Buffer; fReader = new StreamReader(FileName,Encoding.Default, true); while (!fReader.EndOfStream) … | |
Re: Use SyncLock...End SyncLock to prevent other threads to update rows at the same time [CODE=VB.NET]Private Sub BackgroundWorker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork SyncLock DataGridView2.Rows If DataGridView2.Rows.Item(num).Cells.Item(0).Value = "" Then DataGridView2.Rows.Add(1) End SyncLock[/CODE] Read more about the [URL="http://msdn.microsoft.com/en-us/library/3a86s51t%28VS.80%29.aspx"]SyncLock Statement[/URL] in the MSDN. HTH | |
Re: Use [URL="http://www.developerfusion.com/tools/convert/csharp-to-vb/"]Developer Fusion's C# to VB.NET converter[/URL] (yes, it's C# converter, I know). Converted code [U]looked[/U] ok to me. | |
Re: I did a resizeable picture box as an user control some time ago. The picture box (= user control) maintains it's size, but you can zoom in and out the image with Zoom property. [CODE=VB.NET]Option Explicit On Option Strict On Imports System Imports System.ComponentModel Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms … | |
Re: Enclose text field values in quotes: [CODE=VB.NET] Dim strSQL As String = ("UPDATE Staff SET StaffName = ['" & _ namebox.Text & "'] ,Address = ['" & addbox.Text & _ "'] ,Phone = ['" & phone & "'] ,JobPosition = ['" & _ posbox.Text & "'] ,JobStat = ['" & … | |
Re: You [B]can[/B] convert hh:mm:ss to a date, check it's valid and get the difference between times [CODE=VB.NET]Dim TimeA As Date Dim TimeB As Date Dim hh As Integer Dim mm As Integer Dim ss As Integer If Not Date.TryParse(TextBox1.Text, TimeA) Then ' Not a date End If If Not Date.TryParse(TextBox2.Text, … | |
Re: Use tab control's SelectedIndex property to change tab page. Here's a simple sample snippet [CODE=VB.NET]Public Class Form2 Private m_CurrentIndex As Integer Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' m_CurrentIndex = 0 ' Start with first tab End Sub Private Sub Button2_Click(ByVal sender As System.Object, … | |
Re: Are you adding checkboxes to datagrid at runtime? [CODE=VB.NET]Dim chk As New DataGridViewCheckBoxCell If condition Then chk.Value = True Else chk.Value = False End If ' Add checkbox control to datagrid DataGridView1.Item(0, 0) = chk[/CODE] If not, then [CODE=VB.NET]If condition Then DataGridView1.Item(0, 0).Value = True Else DataGridView1.Item(0, 0).Value = False … | |
Re: I didn't test this at all but you could try to use [ICODE]WebBrowser1.Document.GetElementById[/ICODE] method. Few other methods or properties that might help you are [ICODE]WebBrowser1.Document.ActiveElement[/ICODE] and [ICODE]WebBrowser1.Document.DomDocument[/ICODE]. See the web browser control's documentation how to use them and what they do. There's no direct method to obtain either frame or … | |
Re: AFAIK MS Access does not have a built-in Soundex function. You have to write your own. Here's an article from MSDN: [URL="http://msdn.microsoft.com/en-us/library/aa662178(office.11).aspx"]Building Microsoft Access Applications[/URL] with VB (VBA?) code for Soundex function. See if it's for any help. | |
Re: [QUOTE]what is the datatype i used in my sql database for the images?[/QUOTE] I suggest using BLOB data type. [QUOTE]how do I do my saving[/QUOTE] convert image to an array of bytes first. See [URL="http://windevblog.blogspot.com/2008/08/save-binary-data-to-sql-server-with.html"]Save binary data to SQL Server with VB.NET[/URL] how to save byte array to SQL Server. … | |
Re: Common way to receive email is a POP3 server. .NET doesn't provide a built-in POP3 server so you'll have to write one of your own or get a third-party POP3 server. To get you started, try googling [URL="http://www.google.com/search?q=vb.net+pop3+server"]http://www.google.com/search?q=vb.net+pop3+server[/URL]. HTH P.s. I hope I don't help to build yet another spamming … | |
Re: One way to export data to an (existing) Excel file is to use OleDb (namespace System.Data.OleDb). Check out [URL="http://connectionstrings.com/excel"]Connection strings for Excel[/URL] how to form a proper connection string to access an Excel file. If you want to write a general Excel export, I suggest importing data from the data … | |
Re: [QUOTE]Is is possible? To send the command line arguments to the ruunning exe[/QUOTE] No, it isn't because your WindowsApplication2.exe instance is already running. You could use [URL="http://msdn.microsoft.com/en-us/library/system.net.sockets%28VS.80%29.aspx"]sockets[/URL] for inter-process communication or see what the [URL="http://msdn.microsoft.com/en-us/library/ms735119.aspx"]Windows Communication Foundation[/URL] (.NET 3.5) has to offer. One simple solution would be to use files. … | |
Re: [QUOTE]Also, Im getting errors that OpenFile.Filename is not available. And the picIcons[/QUOTE] The code doesn't work "as is". You have to modify it for your purposes like you do with any other sample code. Just drop OpenFileDialog and Picture Box controls on the form. I didn't test djjaries's code but … | |
Re: [QUOTE]can I use array list as 2- dimensinal ??[/QUOTE] Yes you can [CODE=VB.NET]Dim MyList As New ArrayList() Dim Arr1() As Integer = {1, 2, 3} Dim Arr2() As Integer = {4, 5, 6} MyList.Add(Arr1) MyList.Add(Arr2) MsgBox(CType(MyList.Item(1), Integer())(2)) ' -> Second item (array) and third item in the array, output: 6[/CODE]Just … | |
Re: [QUOTE].ini has just two lines in it basically a [VarHead] and then the KEY="..." (what I posted earlier). It is possible that it's being hashed, I tried to pull the data binary but it kept throwing errors like crazy.[/QUOTE] Just my guess. It's 256 bit AES key. They would be … | |
Re: I haven't ever done SMS sending but noticed one point in your code: [CODE=VB.NET]serialPort.Write("AT+CMGS=" & RichTextBox1.Text & vbCrLf & TextBox1.Text & Chr(26)) 'set command message format to text[/CODE]Are you aware that SMS length is limited to 160 ASCII characters or 70 Unicode characters? Does your text exceed these limits? You … | |
Re: Change [ICODE]If ckbox.Selected = True Then[/ICODE] to [ICODE]If ckbox.Checked Then[/ICODE] I think that's what you want. HTH | |
Re: Sorry, wrong forum. Post your question to DaniWeb's [URL="http://www.daniweb.com/forums/forum61.html"]C# forum[/URL]. | |
Re: Here's a few things to fix first: - add [ICODE]Option Strict On[/ICODE] and [ICODE]Option Explicit On[/ICODE] lines at the beginning of vb-file - line 19: you refer to draggedlabel but you haven't declared it. Is it a label control in the form? - line 22: sender is of type Object … | |
Re: Use string classes Format method: [CODE=VB.NET]Dim Money As Double = 1234.56 MsgBox(String.Format("{0:C}", Money))[/CODE] HTH | |
Re: Neither did I get this :) But if you don't know the number of array elements at the compile time, pass it to the constructor of your (partial) class. I would do something like this [CODE=VB.NET]Partial Public Class CItem1 Public Prop1 As Integer Public Prop2 As String Public Sub New(ByVal … | |
Re: [QUOTE]I am planning on making a biometrics attendance system. I have the hardware and planning on creating a software. [/QUOTE] Basically you're readind serial data from COM-port and that is equally easy (or difficult) task with VB.NET, VB6 and C++ (or C#). Most of your application will deal with other … | |
Re: [QUOTE]I'm having trouble getting this to work[/QUOTE] Your code actually works i.e. midtermLabel and finalLabel [B]variables[/B] will hold the desired values. [QUOTE]I know there are some mistakes[/QUOTE] Your Do-loop is obsolete. The code finds the highest values in the For Next loops (in the first round) so you could remove … | |
Re: AFAIK the only way to do it is to place the save button outside the group box control. Without knowing how your applications UI looks like (and how you want it to look like), I would put the Save, Ok, Cancel and similar buttons outside of the group box and … | |
Re: Here's one solution [CODE=VB.NET]' Test string Dim str As String = "The decorated pieplate contains a surprise" Dim Words() As String Dim Word As String ' Number of syllables to search for Dim SearchSyllableCount As Integer = 3 Dim pattern As String = "[aeiouy]+" Dim count As Integer = 0 … | |
Re: Catch the media player error [CODE=VB.NET]' Try to play a text file AxWindowsMediaPlayer1.URL = "D:\test.txt" . . Private Sub AxWindowsMediaPlayer1_ErrorEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxWindowsMediaPlayer1.ErrorEvent ' Catch player errors Dim oErrorItem As WMPLib.IWMPErrorItem If CType(sender, AxWMPLib.AxWindowsMediaPlayer).Error.errorCount > 0 Then oErrorItem = CType(sender, AxWMPLib.AxWindowsMediaPlayer).Error.Item(0) If oErrorItem.errorCode = … | |
Re: You want to resize the player, [B]not[/B] the image displayed in the player? [CODE=VB.NET]AxWindowsMediaPlayer1.Size = New Size(AxWindowsMediaPlayer1.Width + 5, AxWindowsMediaPlayer1.Height + 5)[/CODE] | |
Re: [QUOTE]it said, there was a problem[/QUOTE] Did you get any exact error message? [QUOTE]Do you need anything installed on the computer to use this?[/QUOTE] You need MCI.ocx of course. Is it included in your installation package? [QUOTE]What could be the reason for this?[/QUOTE] If you didn't distribute the MCI.ocx you … | |
![]() | Re: Here's a sort of workaround [CODE=VB.NET]Private Sub MyMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) ' Your "MouseDown" End Sub Private Sub Form2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown ' Call MyMouseDown ' Trap left mouse button If e.Button = Windows.Forms.MouseButtons.Left Then MyMouseDown(sender, e) End If End … |
The End.