C
C#2y ago
Fischi

✅ WPF Label does not print out the first underline _

private void btn_Login(object sender, RoutedEventArgs e)
{
username = txtbox_login_username.Text;
password = txtbox_login_password.Text;
connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.218.128)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl.localdomain)));User Id=dmsadm;Password=dmsadm;";
OracleConnection connection = new OracleConnection(connectionString);
connection.Open();


string loginid_sqlstring = "_ SE_LECT USER_ID FROM DMS_USERS WHERE USERNAME = 'test';";
TestLabel1.Content = (loginid_sqlstring);
string loginpassword_sqlstring = "SELECT password FROM DMS_USERS WHERE USERID = '" + loginid_sqlstring + "';";
}
private void btn_Login(object sender, RoutedEventArgs e)
{
username = txtbox_login_username.Text;
password = txtbox_login_password.Text;
connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.218.128)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl.localdomain)));User Id=dmsadm;Password=dmsadm;";
OracleConnection connection = new OracleConnection(connectionString);
connection.Open();


string loginid_sqlstring = "_ SE_LECT USER_ID FROM DMS_USERS WHERE USERNAME = 'test';";
TestLabel1.Content = (loginid_sqlstring);
string loginpassword_sqlstring = "SELECT password FROM DMS_USERS WHERE USERID = '" + loginid_sqlstring + "';";
}
Something is wrong with the --> TestLabel1.Content = (loginid_sqlstring); It does not print out the first underline for whatever reason
6 Replies
Fischi
FischiOP2y ago
<Window x:Class="DMS.Login"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DMS"
mc:Ignorable="d"
Title="Login" Height="200" Width="280">
<Grid>
<Button Content="Login" HorizontalAlignment="Left" Margin="94,94,0,0" VerticalAlignment="Top" Click="btn_Login"/>
<TextBox x:Name="txtbox_login_username" HorizontalAlignment="Left" Margin="107,14,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/>
<Label Content="Username:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtbox_login_password" HorizontalAlignment="Left" Margin="107,47,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/>
<Label Content="Password:" HorizontalAlignment="Left" Margin="10,41,0,0" VerticalAlignment="Top"/>
<Label x:Name="TestLabel1" Content="" HorizontalAlignment="Center" Margin="0,130,0,0" VerticalAlignment="Top"/>
</Grid>
</Window>
<Window x:Class="DMS.Login"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DMS"
mc:Ignorable="d"
Title="Login" Height="200" Width="280">
<Grid>
<Button Content="Login" HorizontalAlignment="Left" Margin="94,94,0,0" VerticalAlignment="Top" Click="btn_Login"/>
<TextBox x:Name="txtbox_login_username" HorizontalAlignment="Left" Margin="107,14,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/>
<Label Content="Username:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtbox_login_password" HorizontalAlignment="Left" Margin="107,47,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/>
<Label Content="Password:" HorizontalAlignment="Left" Margin="10,41,0,0" VerticalAlignment="Top"/>
<Label x:Name="TestLabel1" Content="" HorizontalAlignment="Center" Margin="0,130,0,0" VerticalAlignment="Top"/>
</Grid>
</Window>
thats my wpf
Klarth
Klarth2y ago
Looks like it's an issue with Label. The first _ might have some special meaning.
Klarth
Klarth2y ago
Klarth
Klarth2y ago
<TextBlock
x:Name="TestLabel1"
Margin="0,130,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
TextWrapping="Wrap"
Text="" />
<TextBlock
x:Name="TestLabel1"
Margin="0,130,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
TextWrapping="Wrap"
Text="" />
You should use TextBlock to display pretty much all text.
Klarth
Klarth2y ago
Stack Overflow
Cannot see _ (underscore) in WPF content
A very simple question: Why I cant see _ (underscore) in WPF content? For instance the content of <Label Content="test_t" Name="label2" /> is shown as "testt" (with the underscore not sh...
Fischi
FischiOP2y ago
Oh okay i see. Yeah i am new to WPF so i always used label to check my output since i dont have a console which i was used to. Thanks for you answer
Want results from more Discord servers?
Add your server