displaying a Message when color is not chosen from the combobox in MFC


Hi ,
Im doing a program for changing the colour of controls selected from the combo box. my doubt is , when submit is given without selecting a colour from combo a message must appear " select a colour". im not getting the pop up message,,, I dono wat mistake i did .pls guide me
My coding
void CComboTestDlg::OnButton1()
{
    int index = m_ColorCombo.GetCurSel();
if(index != CB_ERR)
{
      m_brush.DeleteObject();
      switch(index)
      {
      case 0:
      m_brush.CreateSolidBrush(RGB(0, 240, 120));
      break;
      case 1:
      m_brush.CreateSolidBrush(RGB(128, 0, 240));
      break;
      case 2:
      m_brush.CreateSolidBrush(RGB(0, 128, 0));
      break;
      case 3:
      m_brush.CreateSolidBrush(RGB(128, 128, 0));
      break;
      case 4:
      m_brush.CreateSolidBrush(RGB(0, 0, 128));
      break;
      default:
        m_brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOWTEXT));
        break;
    }
      Invalidate(TRUE);
}
else
      {
      AfxMessageBox("Select A colour");
      }
}
Posted On: Thursday 13th of September 2012 10:25:57 PM Total Views:  44
View Complete with Replies

RELATED TOPICS OF Visual Basic PROGRAMMING LANGUAGE




MDI Application - Caption Bar displaying on Child Form

rated by 0 users I'm converting a VB6.0 application to VB2008 Net (Express Edition).  I used the converter to convert the code. On all of one of my child forms, I have the FormBorderStyle = none.  My frmSplash timer's Tick events, loads the forms as follows:   Private Sub tmrSelect_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrSelect.Tick Call ResumeSplash() tmrSelect.Enabled = False 'recommended by vbcity.com End Sub Private Sub ResumeSplash() On Error GoTo TheErrorHandler Dim strDefaultFile As String Dim intBoards As Short Dim blnFileFound As Boolean blnFileFound = False 'below added because frmShow was looping back to this. If strLastForm = "frmShow" Then Exit Sub End If 'Open default boards file - same folder as EXE 'removed for debugging 'Load Forms strLastForm = "frmSplash" mdiBackground.Show() - this is the MDI Parent form frmWelcome.Show() ' -child form that displays at the top and just says 'Welcome' Call DisplayForms() Exit Sub End Sub Public Sub DisplayForms() If gblnBoardOpened Then frmSentenceStrip.Show() 'child form replaces the frmWelcome form frmShow.Show() 'this is the child form who's caption bar is displaying and then disapearing frmStatus.Show() ' child form that displays to the right of frmShow frmWelcome.Close() Else frmOpenFiles.Show() 'dialog form, when done it displays the child forms above and the same thing happens on frmShow, the caption bar displays and then disappears End If End Sub   Does anyone know why the caption bar is displaying when FormBorderStyle = None  
VIEWS ON THIS POST

41

Posted on:

Thursday 13th September 2012
View Replies!

Icon not displaying when exe is created.

For the exe generated, the Icon is not displayed. I added the Icon in the project Properties --> Make tab --> Application --> Icon.  I am using Vb 6.0 I can see the icon in the project properties. but the same is not displayed when the exe is generated. I added the icon in the resource file too. But   its not displayed. I added the image for it. Please help me in displaying the icon for the exe generated.  
VIEWS ON THIS POST

158

Posted on:

Monday 17th September 2012
View Replies!

displaying fields and counting from a database with recordset for validation

I also have a problem with the following code Dim xDim yx = "E:\New Folder (4)\(Visa)EquityBank.mdb"'App.Path & "\cashboxusers.mdb"    y = "cardholders"    On Error GoTo DataError        ' Open the database.    Set db = OpenDatabase(x)    ' Open the recordset.    Set rs = db.OpenRecordset( _        "SELECT COUNT (*) as cardnumber FROM cardholders WHERE cardnumber = ('" & Me.txtAccountNumber & "')")                    ' Display the result.   ' lblCount.Caption = "Table has " & _    '    Format$(rs.Fields(0)) & " records."If Format$(rs.Fields(0)) = 0 Then    MsgBox "Check Username or Password"   Else: MsgBox "Transaction succesful  " & rs.Fields.Item("cardnumber").Value    End If    rs.Close    db.Close        Exit SubDataError:    MsgBox "Error " & Err.Number & _        " counting records." & _        vbCrLf & vbCrLf & Err.DescriptionEnd SubI'm trying to display records from the database ie two fields but dont know how
VIEWS ON THIS POST

129

Posted on:

Thursday 20th September 2012
View Replies!

displaying fields and counting from a database with recordset for validation

I also have a problem with the following code Dim xDim yx = "E:\New Folder (4)\(Visa)EquityBank.mdb"'App.Path & "\cashboxusers.mdb"    y = "cardholders"    On Error GoTo DataError        ' Open the database.    Set db = OpenDatabase(x)    ' Open the recordset.    Set rs = db.OpenRecordset( _        "SELECT COUNT (*) as cardnumber FROM cardholders WHERE cardnumber = ('" & Me.txtAccountNumber & "')")                    ' Display the result.   ' lblCount.Caption = "Table has " & _    '    Format$(rs.Fields(0)) & " records."If Format$(rs.Fields(0)) = 0 Then    MsgBox "Check Username or Password"   Else: MsgBox "Transaction succesful  " & rs.Fields.Item("cardnumber").Value    End If    rs.Close    db.Close        Exit SubDataError:    MsgBox "Error " & Err.Number & _        " counting records." & _        vbCrLf & vbCrLf & Err.DescriptionEnd SubI'm trying to display records from the database ie two fields but dont know how
VIEWS ON THIS POST

235

Posted on:

Thursday 20th September 2012
View Replies!

displaying fields from a database with recordset

I also have a problem with the following code Dim xDim yx = "E:\New Folder (4)\(Visa)EquityBank.mdb"'App.Path & "\cashboxusers.mdb"    y = "cardholders"    On Error GoTo DataError        ' Open the database.    Set db = OpenDatabase(x)    ' Open the recordset.    Set rs = db.OpenRecordset( _        "SELECT COUNT (*) as cardnumber FROM cardholders WHERE cardnumber = ('" & Me.txtAccountNumber & "')")                    ' Display the result.   ' lblCount.Caption = "Table has " & _    '    Format$(rs.Fields(0)) & " records."If Format$(rs.Fields(0)) = 0 Then    MsgBox "Check Username or Password"   Else: MsgBox "Transaction succesful  " & rs.Fields.Item("cardnumber").Value    End If    rs.Close    db.Close        Exit SubDataError:    MsgBox "Error " & Err.Number & _        " counting records." & _        vbCrLf & vbCrLf & Err.DescriptionEnd SubI'm trying to display records from the database ie two fields but dont know how
VIEWS ON THIS POST

162

Posted on:

Thursday 20th September 2012
View Replies!

Help with displaying graph in vb6 application...

Hi , We have a Hospital management system. we need to display graphs in the forms. But i do not have any idea of it. I did some search on google and found references for MSChart control and Fusion Chart control (this is not free). I am not satisified with the way the MSChart control works (I downloaded some sample projects from sites). Can anyone suggest me any control that i can use to create the graph or any third party application that can be integrated with my application\t
VIEWS ON THIS POST

167

Posted on:

Thursday 20th September 2012
View Replies!

displaying fields from a database

I also have a problem with the following code Dim xDim yx = "E:\New Folder (4)\(Visa)EquityBank.mdb"'App.Path & "\cashboxusers.mdb"    y = "cardholders"    On Error GoTo DataError        ' Open the database.    Set db = OpenDatabase(x)    ' Open the recordset.    Set rs = db.OpenRecordset( _        "SELECT COUNT (*) as cardnumber FROM cardholders WHERE cardnumber = ('" & Me.txtAccountNumber & "')")                    ' Display the result.   ' lblCount.Caption = "Table has " & _    '    Format$(rs.Fields(0)) & " records."If Format$(rs.Fields(0)) = 0 Then    MsgBox "Check Username or Password"   Else: MsgBox "Transaction succesful  " & rs.Fields.Item("cardnumber").Value    End If    rs.Close    db.Close        Exit SubDataError:    MsgBox "Error " & Err.Number & _        " counting records." & _        vbCrLf & vbCrLf & Err.DescriptionEnd SubI'm trying to display records from the database ie two fields but dont know how
VIEWS ON THIS POST

132

Posted on:

Thursday 20th September 2012
View Replies!

displaying records from acces database on to a vb form

am doin a travel management system project.am reserving seats from a reservation form the values of which are added to a Customer ReservationTable.i want to display certain information from CustomerReservationTable on to a Ticket page,,,,but the problem is tht just the first record is displayed on the ticket instead of the current record entered.i used the MoveNext property of the recordset but no use, the second last record is displayed but i want the currently entered record to be displayed.
VIEWS ON THIS POST

138

Posted on:

Friday 21st September 2012
View Replies!

displaying required records from database into a vb form

i have two tables namely CustomerReservationTable and BusTable in access 2000 database using which am inserting some information from the form into CustomerReservationTable and wen user clicks on Reserve button i want some information to be extracted from BusTable and displayed onto the same form......for the same purpose am firing the following query:TicketDisplayRS.Open "Select BoardingPlace,DeaprtureTime,DateOfJourney from BusTable where BusName='" & BusNameComboBox.Text & "'", conn2but its of no use,instead am just getting the first record from BusTable displayed everytime i click on Reserve Button,,,hope to get some reply soon,,its really urgent
VIEWS ON THIS POST

161

Posted on:

Friday 21st September 2012
View Replies!

Help displaying data from multiple tables

I have a Link table containing the IDs of several tables, how do I load The Gridview with the description of the tables based on the ID of the Link table matching the ID of the tables I am using VS2010 with ASP.NET. For example: Table 1 Receiver_ID\t\t\t Description1\t\t\t\t\t\t\t\t\t\t\t FRA2\t\t\t\t\t\t\t\t\t\t\t GBR3\t\t\t\t\t\t\t\t\t\t\t NLD Table 2 NSN_ID\t\t\t\t\t\t\t Description1\t\t\t\t\t\t\t\t\t\t\t\t 13052\t\t\t\t\t\t\t\t\t\t\t\t 14113\t\t\t\t\t\t\t\t\t\t\t\t 1521 If the Link Table contains the following: Link_ID\t Receiver_ID\t\t\t\t NSN_ID1\t\t\t\t\t\t\t\t\t 1\t\t\t\t\t\t\t\t\t 32\t\t\t\t\t\t\t\t\t 3\t\t\t\t\t\t\t\t\t 2 The Gridview should load with the following data in the form load event: Link_ID\t Receiver\t\t\t NSN1\t\t\t\t\t FRA\t\t\t\t\t\t 15212\t\t\t\t\t NLD\t\t\t\t\t\t 1411
VIEWS ON THIS POST

249

Posted on:

Saturday 29th September 2012
View Replies!

loading xml document in atext box(displaying )

http://vbcity.com/forums/p/129777/553868.aspx with refernece to the above post i want to load xml & xsd documents in a textbox like shown in the above link wusing load resource when i a trying touse the same i get error msg objct reference not set toinstance of object i hvae the names of my xml & xsd files in a variables how do i use the similar function
VIEWS ON THIS POST

145

Posted on:

Tuesday 9th October 2012
View Replies!

MDI Application - Caption Bar displaying on Child Form

I'm converting a VB6.0 application to VB2008 Net (Express Edition). I used the converter to convert the code. On all of one of my child forms, I have the FormBorderStyle = none. My frmSplash timer's Tick events, loads the forms as follows: Private Sub tmrSelect_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrSelect.Tick Call ResumeSplash() tmrSelect.Enabled = False 'recommended by vbcity.com End Sub Private Sub ResumeSplash() On Error GoTo TheErrorHandler Dim strDefaultFile As String Dim intBoards As Short Dim blnFileFound As Boolean blnFileFound = False 'below added because frmShow was looping back to this. If strLastForm = "frmShow" Then Exit Sub End If 'Open default boards file - same folder as EXE 'removed for debugging 'Load Forms strLastForm = "frmSplash" mdiBackground.Show() - this is the MDI Parent form frmWelcome.Show() ' -child form that displays at the top and just says 'Welcome' Call DisplayForms() Exit Sub End Sub Public Sub DisplayForms() If gblnBoardOpened Then frmSentenceStrip.Show() 'child form replaces the frmWelcome form frmShow.Show() 'this is the child form who's caption bar is displaying and then disapearing frmStatus.Show() ' child form that displays to the right of frmShow frmWelcome.Close() Else frmOpenFiles.Show() 'dialog form, when done it displays the child forms above and the same thing happens on frmShow, the caption bar displays and then disappears End If End Sub Does anyone know why the caption bar is displaying when FormBorderStyle = None
VIEWS ON THIS POST

75

Posted on:

Saturday 13th October 2012
View Replies!

Filtering and displaying database

------------------------------------------------------------------------------------------------Put your PC to good work at vbCity at world community grid and join Team vbCity.10,210,819points and ranked 1,839th as of June 23 2011!------------------------------------------------------------------------------------------------ #mce_temp_url# | Post Points: 5 berfles Since 5/10/2007 Posts 74 Reputation 1,270 Reply berfles (berfles) replied on 1/26/2009 6:52 AM rated by 0 users I thought it might, but I don't see any issues like that.I'm also getting these two errors:"Cannot perform '=' operation on System.String and System.Int32.""Unable to cast object of type 'System.DBNull' to type 'AppointmentsDataTable'."The second one highlights this line: .AppointmentsTableAdapter.Fill(.EbtblsDataSet1.Appointments.DoctorColumn.DefaultValue)
VIEWS ON THIS POST

101

Posted on:

Saturday 13th October 2012
View Replies!

displaying image

Aamir Mustafa | Post Points: 35 Kulrom Republic of Macedonia Since 5/29/2006 Posts 2,835 Reputation 17,429 Reply Kulrom (Kulrom) replied on 1/5/2009 11:52 PM rated by 0 users Please try this:Code: \t\t\t\tDim cc As New SqlConnection(strCn)\t\t\t\tDim cmd As New SqlCommand("SELECT Picture from tblImgData where ID=" & ListBox1.SelectedIndex & "", cc)\t\t\t\tDim dr As SqlDataReader\t\t\t\tcc.Open() \t\t\t\tdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)\t\t\t\tIf dr.Read Then\t\t\t\t\t\tDim bytBLOBData(dr.GetBytes(1, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte\t\t\t\t\t\tdr.GetBytes(1, 0, bytBLOBData, 0, bytBLOBData.Length)\t\t\t\t\t\tDim stmBLOBData As New MemoryStream(bytBLOBData)\t\t\t\t\t\tPictureBox1.Image = Image.FromStream(stmBLOBData)\t\t\t\tEnd If\t\t\t\tdr.Close()\t\t\t\tYou don't need the params in this situation :)
VIEWS ON THIS POST

187

Posted on:

Saturday 13th October 2012
View Replies!

hyperlink displaying url info problem

{I have 99 problems, but the itch ain't one. Thank you Canesten Cream!} | Post Points: 5 giadich Houston, TX Since 7/18/2006 Posts 291 Reputation 1,455 Reply Brian Dao (giadich) replied on 12/6/2007 6:22 AM rated by 0 users Code:function mover(){window.status='u spek ebonic or sumtin\t'}function mout(){window.status='bye there'}sum link
VIEWS ON THIS POST

117

Posted on:

Saturday 13th October 2012
View Replies!

Textbox not displaying data until loop is completed.

Rock (Arnaldo Sandoval), former Microsoft MVP Visual Developer"One can't possibly test everything" (Albert Einstein)Articles and Resources This page contains links to several articles collected over time here at VbCity | Post Points: 5 fibaoptix South Africa Since 8/1/2005 Posts 357 Reputation 5,080 Reply Dave Arnoldi (fibaoptix) replied on 9/17/2006 7:52 AM rated by 0 users Yep, that's what I needed,
VIEWS ON THIS POST

134

Posted on:

Monday 15th October 2012
View Replies!

How can I update a top-level menu before displaying it?

I can't put the updating code in the click event handler. In VB6, if the user clicks the menu, the click event handler is called AFTER the menu is displayed . Furthermore, unlike button menus, menus don't provide a "before drop down" event handler. Click is the only event handler . Is there a way to add code to the click event handler to say, "drop down this menu"
VIEWS ON THIS POST

279

Posted on:

Thursday 18th October 2012
View Replies!

problem displaying my random number

hi i have a snippet of code which i have in a module and it produces series of random numbers. now when i have it output to a control array of labels it put the word FALSE in the label instead of the generated random number. here is the code im using Code: Public Function CallNumbers() Dim arrNumber(1 To 75) As Integer ' Array Dim intLucky As Integer ' Random Number Dim intCount As Integer ' Selection Counter Dim intCheck As Integer ' Previous Selection Counter For intCount = 1 To 75 ' Select 75 Numbers Start: ' Start Point Randomize (Timer) ' Seed Randomiser intLucky = Int((75 * Rnd) + 1) ' Random number 1 to 75 For intCheck = 1 To 75 If intLucky = arrNumber(intCheck) Then GoTo Start 'If selected number already present, select again End If Next intCheck arrNumber(intCount) = intLucky ' Store selected number in array Screen1.Label1(0).Caption = (intCount - 1) = arrNumber(intCount) ' apply selection to labels (this is whats giving me the return of false in the label1(0)) Next intCount End Function also i need help to try and have the rnd number display each number with a pause between each of say half a second.
VIEWS ON THIS POST

232

Posted on:

Wednesday 24th October 2012
View Replies!

label caption not displaying stopwatch smoothly

I forgot where i got this code but it is a stopwatch and works perfect. i tweaked it to meet my requirements but I forgot its original source location. I have download DS-DIGIT.TTF for diplaying 00:00:00.00 format in digital form. it looks smooth when the font is small, like 8-9. but i want to make the font big, at least 72. but each time it updates the times, there is a flicker in the caption. i thot a faster interval at a timer control would fix it but it didn't. any suggestions Code: Private Sub Command14_Click() If Command14.Caption = "Start" Then fTimerStart = Timer tmrStopwatch.Enabled = True Command14.Caption = "Stop" Else stopwatch = True tmrStopwatch.Enabled = False Command14.Caption = "Start" End Sub Private Sub tmrStopwatch_Timer() Dim fTime As Single fTime = Timer - fTimerStart lblStopwatchDisplay.Caption = Format(CSng(fTime / 86400), "hh:nn:") & Format((CLng(CDbl(fTime) * 1000) Mod 60000) / 1000, "00.00") End Sub
VIEWS ON THIS POST

129

Posted on:

Wednesday 24th October 2012
View Replies!

Re: problem displaying controls on form

I am working on a VB 6 application. I have a form with a Picture box with a vscroll bar, this picture box also has another Picture box placed on it with 4 frame controls each frame has a set of controls (label, combos etc..) This is a scrollable form. The problem I am haveing is when the form first loads none of the controls are visiable (yes the visible properties is true) but if I tab through the form the controls start to show up. Also if I scroll to the botton and then back up the frames start to show up. I think it is a timeing thing, and has something to do with the form painting. When I run it in debug mode, if I toggle over to the code view and then back to the form all the frames are visible as they should be. any ideas\t
VIEWS ON THIS POST

133

Posted on:

Wednesday 24th October 2012
View Replies!