646 Posted Topics

Member Avatar for madlan

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

Member Avatar for madlan
0
143
Member Avatar for kdcorp87

[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 …

Member Avatar for kdcorp87
0
337
Member Avatar for nickguletskii

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 …

Member Avatar for nickguletskii
0
91
Member Avatar for Ebisu

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 …

Member Avatar for Teme64
0
2K
Member Avatar for Sidiq

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

Member Avatar for Teme64
0
802
Member Avatar for homeryansta

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 …

Member Avatar for Teme64
0
208
Member Avatar for Kingcoder210

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 …

Member Avatar for Teme64
0
81
Member Avatar for onlinessp

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]

Member Avatar for pabloh007
1
220
Member Avatar for Ebisu

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 …

Member Avatar for SiahCheePing
0
121
Member Avatar for Saravanan R

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 …

Member Avatar for Netcode
0
109
Member Avatar for wb4whd

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 …

Member Avatar for wb4whd
0
167
Member Avatar for sartana

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) …

Member Avatar for sartana
0
878
Member Avatar for tony_waza

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 …

Member Avatar for Teme64
0
217
Member Avatar for tom3.14

[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 …

Member Avatar for Teme64
0
791
Member Avatar for Kingcoder210

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 …

Member Avatar for meffe
1
263
Member Avatar for jellybeannn

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: …

Member Avatar for Teme64
0
101
Member Avatar for Kingcoder210

> 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 …

Member Avatar for Teme64
0
3K
Member Avatar for DaveTran

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 …

Member Avatar for DaveTran
2
200
Member Avatar for sumangala

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) …

Member Avatar for Teme64
0
98
Member Avatar for justme369

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

Member Avatar for Teme64
0
95
Member Avatar for justme369

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.

Member Avatar for Teme64
0
291
Member Avatar for cutieann12

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 …

Member Avatar for kvprajapati
0
1K
Member Avatar for Robert Walker
Member Avatar for mugun

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 = ['" & …

Member Avatar for JdTSC
0
151
Member Avatar for roby22

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, …

Member Avatar for tonyfonseca
0
1K
Member Avatar for omotoyosi

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, …

Member Avatar for se_raja_in
0
3K
Member Avatar for manoj_582033

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 …

Member Avatar for TomW
0
191
Member Avatar for sreeram01

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 …

Member Avatar for CodeDoctor
0
116
Member Avatar for sonia sardana

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.

Member Avatar for dkmansion
0
769
Member Avatar for DAWNIE

[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. …

Member Avatar for DAWNIE
0
2K
Member Avatar for milhero

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 …

Member Avatar for milhero
0
351
Member Avatar for Piya27

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 …

Member Avatar for Piya27
0
170
Member Avatar for sonia sardana

[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. …

Member Avatar for sknake
0
193
Member Avatar for Tamir09

[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 …

Member Avatar for Teme64
0
309
Member Avatar for Nada_ward

[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 …

Member Avatar for Nada_ward
0
3K
Member Avatar for madcat62

[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 …

Member Avatar for sknake
0
152
Member Avatar for lil_Is

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 …

Member Avatar for chandiusjp
0
156
Member Avatar for Nuela

Change [ICODE]If ckbox.Selected = True Then[/ICODE] to [ICODE]If ckbox.Checked Then[/ICODE] I think that's what you want. HTH

Member Avatar for ema005
0
122
Member Avatar for mansi sharma

Sorry, wrong forum. Post your question to DaniWeb's [URL="http://www.daniweb.com/forums/forum61.html"]C# forum[/URL].

Member Avatar for sknake
0
129
Member Avatar for Nada_ward

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 …

Member Avatar for Nada_ward
0
124
Member Avatar for kerek2

Use string classes Format method: [CODE=VB.NET]Dim Money As Double = 1234.56 MsgBox(String.Format("{0:C}", Money))[/CODE] HTH

Member Avatar for sknake
0
91
Member Avatar for solano

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 …

Member Avatar for Teme64
0
145
Member Avatar for iamnoangel26

[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 …

Member Avatar for iamnoangel26
0
215
Member Avatar for liverpoolfc108

[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 …

Member Avatar for Teme64
0
139
Member Avatar for sandli28

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 …

Member Avatar for Piya27
0
1K
Member Avatar for Steven_C

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 …

Member Avatar for Steven_C
0
408
Member Avatar for sonia sardana

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 = …

Member Avatar for sonia sardana
0
654
Member Avatar for mansi sharma

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]

Member Avatar for mansi sharma
0
189
Member Avatar for plusplus

[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 …

Member Avatar for plusplus
0
201
Member Avatar for Chris11246

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 …

Member Avatar for kvprajapati
0
128

The End.