[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:
[Thread Prev] | [Thread Next]
- Subject: Re:
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Mon, 3 Feb 2025 14:23:33 +0000
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Hang on , looking deeper these seem to be ComboBox's. Surely it is correct to set the ComboBox.Index and incorrect to just set the .Text? CbxFonts.Index = CbxFonts.Find(FMain.sFontName) CbxTailles.Index = CbxTailles.Find(FMain.iFontSize) CbxStyles.Index = Abs(FMain.bFontStyle) Maybe handle for "not found" -1 with Max() CbxFonts.Index = Max(0, CbxFonts.Find(FMain.sFontName)) Respects BruceS On Mon, 3 Feb 2025 at 13:12, Bruce Steers <bsteers4@xxxxxxxxx> wrote: > i don't see how ["False", "True"].Find(Str(bBooloan)) can be "no found" it > will either find "False" or "True" > > But I preferred my last suggestion anyway. > CbxStyles.Text = Str(FMain.bFontStyle) > > Respects > BruceS > > > On Mon, 3 Feb 2025 at 11:24, Fabien Bodard <gambas.fr@xxxxxxxxx> wrote: > >> In this case if the Find function return -1 because of no found... -1 is >> out of the array. >> >> Le dim. 2 févr. 2025 à 23:10, Bruce Steers <bsteers4@xxxxxxxxx> a écrit : >> >>> your list is a String[] Array ["False", "True"] >>> >>> But I assume FMain.bFontStyle is Boolean >>> >>> So try Str() to get a String version of the Boolean value like this... >>> >>> CbxStyles.Text = CbxStyles.List[CbxStyles.Find(Str(FMain.bFontStyle))] >>> ' Use Str() on the Boolean >>> >>> Or maybe simply this... >>> CbxStyles.Text = Str(FMain.bFontStyle) >>> >>> BruceS >>> >>> >>> On Sun, 2 Feb 2025 at 21:39, Philippe Valarcher < >>> philippe.valarcher@xxxxxxx> wrote: >>> >>>> Bonsoir, >>>> is someone can helping me in debbugging this part : >>>> >>>> Public Sub Form_Open() >>>> >>>> Dim fontName As String >>>> Dim fontTaille As String >>>> Dim fontStyle As String >>>> >>>> CbxFonts.Clear() >>>> CbxTailles.Clear() >>>> CbxStyles.Clear() >>>> >>>> ' Module_Settings.RestorePolice >>>> >>>> For Each fontName In Fonts >>>> CbxFonts.Add(fontName) >>>> Next >>>> >>>> For Each fontStyle In ["False", "True"] >>>> CbxStyles.Add(fontStyle) >>>> Next >>>> >>>> For Each fontTaille In ["8", "9", "10", "11", "12", "13"] >>>> CbxTailles.Add(fontTaille) >>>> Next >>>> >>>> CbxFonts.Text = CbxFonts.List[CbxFonts.Find(FMain.sFontName)] >>>> CbxTailles.Text = CbxTailles.List[CbxTailles.Find(FMain.iFontSize)] >>>> ' CbxStyles.Text = CbxStyles.List[CbxStyles.Find(FMain.bFontStyle)] >>>> >>>> End >>>> >>>> If I uncomment the last line the program fail with this : >>>> >>>> >>>> -- >>>> >>>> Regards >>>> >>>> Philippe Valarcher <philippe.valarcher@xxxxxxx> >>>> >>>
Re: FMain.bFontStyle is Boolean | Philippe Valarcher <philippe.valarcher@xxxxxxx> |
Re: | Fabien Bodard <gambas.fr@xxxxxxxxx> |
[no subject] | Philippe Valarcher <philippe.valarcher@xxxxxxx> |
Re: | Bruce Steers <bsteers4@xxxxxxxxx> |
Re: | Fabien Bodard <gambas.fr@xxxxxxxxx> |
Re: | Bruce Steers <bsteers4@xxxxxxxxx> |